Skip to content

Commit

Permalink
修改排班表时立即更新plan
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoZuohong committed Jun 9, 2023
1 parent c97a8a3 commit c02de93
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def serve_index():
@app.route("/conf", methods=["GET", "POST"])
def load_config():
global conf

if request.method == "GET":
conf = load_conf()
return conf
Expand All @@ -56,13 +57,15 @@ def load_config():

@app.route("/plan", methods=["GET", "POST"])
def load_plan_from_json():
global plan

if request.method == "GET":
global conf
global plan
plan = load_plan(conf["planFile"])
return plan
else:
write_plan(request.json, conf["planFile"])
plan = request.json
write_plan(plan, conf["planFile"])
return f"New plan saved at {conf['planFile']}"


Expand Down

2 comments on commit c02de93

@Shawnsdaddy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还是得重启生效对吧??

@ZhaoZuohong
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是。这个“plan”指的就是后端的plan变量,如果Mower正在运行,还需要把Mower停了再开。

Please sign in to comment.