|
|
@ -35,7 +35,6 @@ order = [{"id":i,"value":str(i+1)+"."} for i in range(len(config["teams"]))] |
|
|
|
order.append({"id":"t", "value":"Třezalka"}) |
|
|
|
order.append({"id":"n", "value":"Neběžel"}) |
|
|
|
|
|
|
|
around = 0 |
|
|
|
|
|
|
|
def check_form(form,config): |
|
|
|
errors = [] |
|
|
@ -106,7 +105,7 @@ def hello_world(): |
|
|
|
def form_page(): |
|
|
|
if request.method == 'GET': |
|
|
|
return render_template("form.html", |
|
|
|
round = config["times"][around], |
|
|
|
round = config["times"][config['round']], |
|
|
|
people = config["orgs"], |
|
|
|
order = order, |
|
|
|
teams = config["teams"], |
|
|
@ -117,7 +116,7 @@ def form_page(): |
|
|
|
errors = check_form(request.form,config) |
|
|
|
if errors: |
|
|
|
return render_template("form.html", |
|
|
|
round = config["times"][around], |
|
|
|
round = config["times"][config['round']], |
|
|
|
people = config["orgs"], |
|
|
|
order = order, |
|
|
|
teams = config["teams"], |
|
|
@ -126,11 +125,19 @@ def form_page(): |
|
|
|
for team in config["teams"]: |
|
|
|
order1 = request.form['poradi1_'+str(team['id'])] |
|
|
|
order2 = request.form['poradi2_'+str(team['id'])] |
|
|
|
per1 = request.form['clovek1_'+str(team['id'])] |
|
|
|
per1 = request.form.get('clovek1_'+str(team['id']),None) |
|
|
|
per2 = request.form.get('clovek2_'+str(team['id']),None) |
|
|
|
team["points"] += team_points(per1,order1,per2,order2,config) |
|
|
|
if team["points"] <= 0: |
|
|
|
team["emerg"] += 1 |
|
|
|
team["points"] = 100 |
|
|
|
if "zachranka_"+str(team['id']) in request.form and\ |
|
|
|
team['emerg_remain'] > 0: |
|
|
|
team["points"] = 100 |
|
|
|
team['emerg_remain'] -= 1 |
|
|
|
config["round"] += 1 |
|
|
|
return render_template("form.html", |
|
|
|
round = config["times"][around], |
|
|
|
round = config["times"][config['round']], |
|
|
|
people = config["orgs"], |
|
|
|
order = order, |
|
|
|
teams = config["teams"], |
|
|
|