diff --git a/app.py b/app.py index ce595a5..b259d80 100644 --- a/app.py +++ b/app.py @@ -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"], diff --git a/config.toml b/config.toml index b98fa81..e7f36d4 100644 --- a/config.toml +++ b/config.toml @@ -15,6 +15,7 @@ times = [ "pátek ráno", "pátek v poledne", "pátek večer", + "konec" ] order_coeff = [ @@ -24,6 +25,8 @@ start_pts = 100 base_pts = 20 no_pts = -20 +round = 0 + # Přiřazení léků k orgům [[orgs]] value = "Borek" @@ -64,19 +67,27 @@ no_pts = -20 name = "Doktoři" id = 1 points = 100 + emerg = 0 + emerg_remain = 1 [[teams]] name = "Lékaři" id = 2 points = 100 + emerg = 0 + emerg_remain = 1 [[teams]] name = "Medici" id = 3 points = 100 + emerg = 0 + emerg_remain = 1 [[teams]] name = "Hrobaři" id = 4 points = 100 + emerg = 0 + emerg_remain = 1 diff --git a/static/style.css b/static/style.css index ab0e115..744f606 100644 --- a/static/style.css +++ b/static/style.css @@ -1,3 +1,7 @@ +ul { + list-style-type: none; +} + #content { width: 100%; height: 100%; @@ -7,7 +11,7 @@ align-items: flex-end; } -.team { +.team_bar { display: flex; flex-direction: column; justify-content: flex-end; @@ -17,7 +21,27 @@ .points { font-size: 32pt; } +.emergs { + font-size: 20pt; +} +.teams { + display: flex; + flex-direction: row; + justify-content: space-around; + +} +.team { + margin: 5px; + padding: 5px; + border: 1px solid rgba(128,128,128,1); +} +.persons { + display: flex; + flex-direction: row; + justify-content: space-around; + +} .bar { float: left; diff --git a/templates/form.html b/templates/form.html index 9024ad5..0adea4b 100644 --- a/templates/form.html +++ b/templates/form.html @@ -1,5 +1,7 @@ + + Úprava zdraví pacientů

Zadávání pořadí - {{round}}

@@ -10,29 +12,59 @@
  • {{e}}
  • {% endfor %} +
    {% for team in teams %} -

    Tým {{team.name}}

    -

    Člověk 1:

    -{% for c in people %} - - -{% endfor %} -

    Pořadí

    -{% for p in order %} - - -{% endfor %} -

    Člověk 2:

    -{% for c in people %} - - -{% endfor %} -

    Pořadí

    -{% for p in order %} - - -{% endfor %} +
    +

    Tým {{team.name}}

    +
    +
    +

    Člověk 1:

    +
      + {% for c in people %} +
    • + + +
    • + {% endfor %} +
    +

    Pořadí

    +
      + {% for p in order %} +
    • + + +
    • + {% endfor %} +
    +
    +
    +

    Člověk 2:

    +
      + {% for c in people %} +
    • + + +
    • + {% endfor %} +
    +

    Pořadí

    +
      + {% for p in order %} +
    • + + +
    • + {% endfor %} +
    +
    +
    + {% if team.emerg_remain > 0 %} + + + {% endif %} +
    {% endfor %} +
    diff --git a/templates/tablo.html b/templates/tablo.html index 091cfe9..1c1aa29 100644 --- a/templates/tablo.html +++ b/templates/tablo.html @@ -6,12 +6,16 @@
    {% for t in teams %} -
    +
    {{t.points}}
    +
    +Záchranky: +{{t.emerg}} +
    {% endfor %}