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__":