change top 10 or 20 golfers

This commit is contained in:
Justin 2023-05-15 16:27:49 +08:00 committed by GitHub
parent 4eae72d1e7
commit 0fdf4e2efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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