From 0fdf4e2efc52878bb11856712443378aa3f61b39 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 May 2023 16:27:49 +0800 Subject: [PATCH] change top 10 or 20 golfers --- server.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/server.py b/server.py index dc089a5..0f8c1d3 100755 --- a/server.py +++ b/server.py @@ -1334,6 +1334,29 @@ def saveSchedulerSettings(): return index() +@app.route("/setTop20or10", methods = ['PUT', 'POST']) +def setTop20or10(): + + data= request.data.decode('utf-8') + input_settings = json.loads(data) + + with open('csv/league_tables.json','r') as f: + league_settings = json.load(f) + + if input_settings == 'Top 20': + input_settings = 20 + elif input_settings == 'Top 10': + input_settings = 10 + else: + input_settings = 20 + + league_settings['top20'] = input_settings + + f = open('csv/league_tables.json', 'w') + json.dump(league_settings, f) + f.close() + + return index() if __name__ == "__main__":