Gagan14 commited on
Commit
f626606
·
verified ·
1 Parent(s): 88a3c14

Update server/app.py

Browse files
Files changed (1) hide show
  1. server/app.py +18 -7
server/app.py CHANGED
@@ -24,17 +24,28 @@ def root():
24
  task_list = ["easy", "medium", "hard"]
25
  task_index = 0
26
 
27
- @app.post("/reset")
28
- def reset():
29
- global state, done, task_index
30
-
31
- task = task_list[task_index % 3]
32
- task_index += 1
 
33
 
 
 
 
34
  state = random.choice(emails)
35
- state["task"] = task
36
  done = False
 
37
 
 
 
 
 
 
 
38
  return {"state": state}
39
 
40
  @app.post("/step")
 
24
  task_list = ["easy", "medium", "hard"]
25
  task_index = 0
26
 
27
+ @app.post("/reset_easy")
28
+ def reset_easy():
29
+ global state, done
30
+ state = random.choice(emails)
31
+ state["task"] = "easy"
32
+ done = False
33
+ return {"state": state}
34
 
35
+ @app.post("/reset_medium")
36
+ def reset_medium():
37
+ global state, done
38
  state = random.choice(emails)
39
+ state["task"] = "medium"
40
  done = False
41
+ return {"state": state}
42
 
43
+ @app.post("/reset_hard")
44
+ def reset_hard():
45
+ global state, done
46
+ state = random.choice(emails)
47
+ state["task"] = "hard"
48
+ done = False
49
  return {"state": state}
50
 
51
  @app.post("/step")