From 64d37acc23df66a142255cf22dc2651a523c1f62 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Sun, 3 Mar 2024 00:06:52 +0100 Subject: [PATCH] Many frontend improvements --- formula10/templates/leaderboard.jinja | 67 +++--- formula10/templates/race.jinja | 307 +++++++++++++------------- formula10/templates/result.jinja | 134 +++++------ formula10/templates/rules.jinja | 32 ++- formula10/templates/season.jinja | 30 +-- formula10/templates/statistics.jinja | 105 +++++---- formula10/templates/users.jinja | 18 +- 7 files changed, 375 insertions(+), 318 deletions(-) diff --git a/formula10/templates/leaderboard.jinja b/formula10/templates/leaderboard.jinja index 904f983..863fd51 100644 --- a/formula10/templates/leaderboard.jinja +++ b/formula10/templates/leaderboard.jinja @@ -7,36 +7,51 @@ {% block body %}
+
+ Note +
+
-
Leaderboard
-
Points only include race picks
+ Points only include race picks. +
+
- - - - - - - - - - - +
+
+ Leaderboard +
-
- {% for user in points.users_sorted_by_points() %} - {% set user_standing = points.user_standing()[user.name] %} - - - - - - - +
+
+
PlaceUserPointsTotal picksCorrect picksPoints per pick
{{ user_standing }}{{ user.name }}{{ points.total_points_by(user.name) }}{{ points.picks_count(user.name) }}{{ points.picks_with_points_count(user.name) }}{{ "%0.2f" % points.points_per_pick(user.name) }}
+ + + + + + + + - {% endfor %} - -
PlaceUserPointsTotal picksCorrect picks + Points per pick
+ + + + {% for user in points.users_sorted_by_points() %} + {% set user_standing = points.user_standing()[user.name] %} + + {{ user_standing }} + {{ user.name }} + {{ points.total_points_by(user.name) }} + {{ points.picks_count(user.name) }} + {{ points.picks_with_points_count(user.name) }} + {{ "%0.2f" % points.points_per_pick(user.name) }} + + {% endfor %} + + + diff --git a/formula10/templates/race.jinja b/formula10/templates/race.jinja index 396a793..360b1f0 100644 --- a/formula10/templates/race.jinja +++ b/formula10/templates/race.jinja @@ -14,184 +14,191 @@ {% block body %} - - - - + {# Put table in this div to make right padding work #} +
+
Race
- + + + - - - + - + + + - {# Users List #} - - + - {# Link should only be visible if all users are visible #} - {% if model.active_user is not none %} - - {% else %} - {% for user in model.all_users() %} - + + + {# Link should only be visible if all users are visible #} + {% if model.active_user is not none %} + - {% endfor %} - {% endif %} - - - - - {# Current Result, only displayed for all users overview and if guess is remaining #} - {% if (model.active_user is none) and (model.current_race is not none) %} - - - - - {% if model.all_users() | length > 0 %} + {% else %} {% for user in model.all_users() %} - {% set user_guess = model.race_guesses_by(user_name=user.name, race_name=model.current_race.name) %} - - {% endfor %} - {% else %} - {% endif %} - {# Race countdown #} - - - - {% endif %} - - {# Enter Guess, only displayed for single user focused view and if guess is remaining #} - {% if (model.active_user is not none) and (model.current_race is not none) %} - - - - - - {% endif %} - {# Past Race Results #} - {% for past_result in model.all_race_results() %} - - + {# Current Result, only displayed for all users overview and if guess is remaining #} + {% if (model.active_user is none) and (model.current_race is not none) %} - {% if model.all_users_or_active_user() | length > 0 %} - {% for user in model.all_users_or_active_user() %} - + - {% if user_guess is not none %} - + {% endfor %} + {% else %} + + {% endif %} + + {# Race countdown #} + + + + {% endif %} + + {# Enter Guess, only displayed for single user focused view and if guess is remaining #} + {% if (model.active_user is not none) and (model.current_race is not none) %} + + + + + + + + {% endif %} + + {# Past Race Results #} + {% for past_result in model.all_race_results() %} + + + + {% if model.all_users_or_active_user() | length > 0 %} + {% for user in model.all_users_or_active_user() %} + - {% endfor %} - {% else %} - - {% endif %} + + + {% else %} +   + {% endif %} + + {% endfor %} + {% else %} + + {% endif %} - {# Actual result #} - - - {% endfor %} + +
  • + DNF: {{ past_result.initial_dnf_string() }}
  • + + + + {% endfor %} - -
    Call -
    RaceResult
    Call +
    Result
     
    {{ model.active_user.name }} ({{ points.total_points_by(model.active_user.name) }}) - {{ user.name }} ({{ points.total_points_by(user.name) }}) + {# Users List #} +
     {{ model.active_user.name }} + ({{ points.total_points_by(model.active_user.name) }})  
    - {{ model.current_race.number }}: {{ model.current_race.name }}
    - Guess: P{{ model.current_race.place_to_guess }}
    - Date: {{ model.current_race.date.strftime("%d.%m %H:%M") }} - -
    - {% if user_guess is not none %} -
      -
    • - {{ user_guess.pxx_guess.abbr }} -
    • -
    • - {{ user_guess.dnf_guess.abbr }} -
    • -
    - {% else %} -   - {% endif %} +
    + {{ user.name }} + ({{ points.total_points_by(user.name) }})   - Race starts in:
    - 00d 00h 00m 00s -
    - {{ model.current_race.number }}: {{ model.current_race.name }}
    - Guess: P{{ model.current_race.place_to_guess }}
    - Date: {{ model.current_race.date.strftime("%d.%m %H:%M") }} - -
    - {% set race_guess_open = model.race_guess_open(model.current_race) %} - {% if race_guess_open == true %} - {% set action_save_href = "/race-guess/" ~ model.current_race.name_sanitized ~ "/" ~ model.active_user.name_sanitized %} - {% set action_delete_href = "/race-guess-delete/" ~ model.current_race.name_sanitized ~ "/" ~ model.active_user.name_sanitized %} - {% else %} - {% set action_save_href = "" %} - {% set action_delete_href = "" %} - {% endif %} - - {# Enter + Save guess #} -
    - {% set user_guess = model.race_guesses_by(user_name=model.active_user.name, race_name=model.current_race.name) %} - - {# Driver PXX Select #} - {{ driver_select_with_preselect(driver_match=user_guess.pxx_guess, name="pxxselect", label="P" ~ model.current_race.place_to_guess ~ ":", include_none=true, disabled=not race_guess_open) }} - -
    - - {# Driver DNF Select #} - {{ driver_select_with_preselect(driver_match=user_guess.dnf_guess, name="dnfselect", label="DNF:", include_none=true, disabled=not race_guess_open) }} - - -
    - - {# Delete guess #} -
    - -
    -
     
    - {{ past_result.race.number }}: {{ past_result.race.name }}
    - Guessed: P{{ past_result.race.place_to_guess }}
    - Date: {{ past_result.race.date.strftime("%d.%m %H:%M") }} - -
    - {% set user_guess = model.race_guesses_by(user_name=user.name, race_name=past_result.race.name) %} +
    + {{ model.current_race.number }}: {{ model.current_race.name }}
    + Guess: P{{ model.current_race.place_to_guess }}
    + Date: {{ model.current_race.date.strftime("%d.%m %H:%M") }} + +
    + {% if user_guess is not none %} +
      +
    • + {{ user_guess.pxx_guess.abbr }} +
    • +
    • + {{ user_guess.dnf_guess.abbr }} +
    • +
    + {% else %} +   + {% endif %} +
      + Race starts in:
    + 00d 00h 00m 00s +
    + {{ model.current_race.number }}: {{ model.current_race.name }}
    + Guess: P{{ model.current_race.place_to_guess }}
    + Date: {{ model.current_race.date.strftime("%d.%m %H:%M") }} + +
    + {% set race_guess_open = model.race_guess_open(model.current_race) %} + {% if race_guess_open == true %} + {% set action_save_href = "/race-guess/" ~ model.current_race.name_sanitized ~ "/" ~ model.active_user.name_sanitized %} + {% set action_delete_href = "/race-guess-delete/" ~ model.current_race.name_sanitized ~ "/" ~ model.active_user.name_sanitized %} + {% else %} + {% set action_save_href = "" %} + {% set action_delete_href = "" %} + {% endif %} + + {# Enter + Save guess #} +
    + {% set user_guess = model.race_guesses_by(user_name=model.active_user.name, race_name=model.current_race.name) %} + + {# Driver PXX Select #} + {{ driver_select_with_preselect(driver_match=user_guess.pxx_guess, name="pxxselect", label="P" ~ model.current_race.place_to_guess ~ ":", include_none=true, disabled=not race_guess_open) }} + +
    + + {# Driver DNF Select #} + {{ driver_select_with_preselect(driver_match=user_guess.dnf_guess, name="dnfselect", label="DNF:", include_none=true, disabled=not race_guess_open) }} + + +
    + + {# Delete guess #} +
    + +
    +
     
    + {{ past_result.race.number }}: {{ past_result.race.name }}
    + Guessed: P{{ past_result.race.place_to_guess }}
    + Date: {{ past_result.race.date.strftime("%d.%m %H:%M") }} + +
    + {% set user_guess = model.race_guesses_by(user_name=user.name, race_name=past_result.race.name) %} + + {% if user_guess is not none %} +
      +
    • {{ user_guess.pxx_guess.abbr ~ past_result.driver_standing_position_string(user_guess.pxx_guess) }} -
    • -
    • +
    • +
    • {{ user_guess.dnf_guess.abbr }} -
    • -
    - {% else %} -   - {% endif %} -
       -
      -
    • + {# Actual result #} +
    +
      +
    • P{{ past_result.race.place_to_guess }}: {{ past_result.offset_from_place_to_guess(0).abbr }} -
    • -
    • - DNF: {{ past_result.initial_dnf_string() }}
    • -
    -
    + + + {% endblock body %} \ No newline at end of file diff --git a/formula10/templates/result.jinja b/formula10/templates/result.jinja index 696ff91..2d8fc43 100644 --- a/formula10/templates/result.jinja +++ b/formula10/templates/result.jinja @@ -42,80 +42,86 @@ {% block body %} -
    +
    + +
    +
    + {{ model.active_result_race_name_or_current_race_name() }} +
    -
    +
    +
    + {% set race_result_open=model.race_result_open(model.active_result_race_name_or_current_race_name()) %} + {% if race_result_open == true %} + {% set action_save_href = "/result-enter/" ~ model.active_result_race_name_or_current_race_name_sanitized() %} + {% else %} + {% set action_save_href = "" %} + {% endif %} -
    - {{ model.active_result_race_name_or_current_race_name() }} -
    +
    +
      + {% for driver in model.all_drivers_or_active_result_standing_drivers() %} +
    • P{{ "%02d" % loop.index }}: +
    • + {% endfor %} +
    - {% set race_result_open=model.race_result_open(model.active_result_race_name_or_current_race_name()) %} - {% if race_result_open == true %} - {% set action_save_href = "/result-enter/" ~ model.active_result_race_name_or_current_race_name_sanitized() %} - {% else %} - {% set action_save_href = "" %} - {% endif %} +
      - -
        - {% for driver in model.all_drivers_or_active_result_standing_drivers() %} -
      • P{{ "%02d" % loop.index }}: -
      • - {% endfor %} -
      + {% for driver in model.all_drivers_or_active_result_standing_drivers() %} +
    • + {{ driver.name }} -
        +
        + {# Driver DNFed at first #} +
        + + +
        - {% for driver in model.all_drivers_or_active_result_standing_drivers() %} -
      • - {{ driver.name }} + {# Driver DNFed #} +
        + + +
        -
        - {# Driver DNFed at first #} -
        - - -
        + {# Driver Excluded #} +
        + + +
        +
        - {# Driver DNFed #} -
        - - -
        - - {# Driver Excluded #} -
        - - -
        -
      • - - {# Standing order #} - - - {% endfor %} -
      - - -
    • + {# Standing order #} + + + {% endfor %} +
    + + +
    +
    diff --git a/formula10/templates/rules.jinja b/formula10/templates/rules.jinja index 5182061..7f2d6a9 100644 --- a/formula10/templates/rules.jinja +++ b/formula10/templates/rules.jinja @@ -5,10 +5,12 @@ {% set active_page = "/rules" %} {% block body %} -
    -
    -
    Format
    +
    +
    + Format +
    +

    Das Tippspiel wird dieses Jahr in zwei Teile aufgespalten: Renntips (für jedes Rennen) und Bonustipps (für die ganze Saison). @@ -20,10 +22,12 @@

    -
    -
    -
    Renntipps
    +
    +
    + Renntipps +
    +

    Jedes Rennen besteht aus zwei Tipps. Einem Platzierungstipp (PX-Tipp) und einem Tipp welcher Fahrer als Erstes das Rennen abbricht @@ -39,10 +43,12 @@

    -
    -
    -
    Punkte
    +
    +
    + Punkte +
    +

    Für einen korrekten Tipp werden 10 Punkte vergeben. Beim PX-Tipp werden 6 Punkte für einen Platz Abweichung, 3 Punkte für zwei plätze Abweichung und 1 Punkt @@ -56,10 +62,12 @@

    -
    -
    -
    Bonustipps
    +
    +
    + Bonustipps +
    +

    Zusätzlich gibt es dieses Jahr auch Tipps, die sich auf die ganze Saison beziehen und verschieden bepunktet werden. diff --git a/formula10/templates/season.jinja b/formula10/templates/season.jinja index 4ad761c..e05a9fa 100644 --- a/formula10/templates/season.jinja +++ b/formula10/templates/season.jinja @@ -11,28 +11,32 @@ {% block body %}

    +
    + Note +
    +
    -
    Note
    - Picks that match the current standings are marked in green, except for the hot-take and overtake picks, as those are not evaluated automatically.
    + Picks that match the current standings are marked in green, except for the hot-take and overtake picks, as + those are not evaluated automatically.
    Points from sprints and fastest laps are not tracked currently.
    -
    +
    {% for user in model.all_users_or_active_user() %}
    -
    - +
    {# Link should only be visible if all users are visible #} {% if model.active_user is not none %} -
    {{ user.name }}
    + {{ user.name }} {% else %} - -
    {{ user.name }}
    -
    + {{ user.name }} {% endif %} +
    + +
    {% set user_guess = model.season_guesses_by(user_name=user.name) %} @@ -78,11 +82,11 @@
    {{ driver_select_with_preselect(driver_match=user_guess.most_wdc_gained, name="gainedselect", - label="Most WDC places gained:", include_none=false, drivers=model.drivers_for_wdc_gained(), + label="Most WDC pl. gained:", include_none=false, drivers=model.drivers_for_wdc_gained(), disabled=not season_guess_open, border=("border-success" if points.most_gained_correct(user.name) else "")) }} {{ driver_select_with_preselect(driver_match=user_guess.most_wdc_lost, name="lostselect", - label="Most WDC places lost:", include_none=false, disabled=not season_guess_open, + label="Most WDC pl. lost:", include_none=false, disabled=not season_guess_open, border=("border-success" if points.most_lost_correct(user.name) else "")) }}
    @@ -90,7 +94,7 @@
    Teammate battle winners:
    -
    +
    {% for team in model.all_teams(include_none=false) %} {% set driver_a = model.drivers_by(team_name=team.name)[0] %} {% set driver_b = model.drivers_by(team_name=team.name)[1] %} @@ -126,7 +130,7 @@ {# Drivers with Podiums #}
    Drivers with podium(s):
    -
    +
    {% for team in model.all_teams(include_none=false) %} {% set driver_a = model.drivers_by(team_name=team.name)[0] %} {% set driver_b = model.drivers_by(team_name=team.name)[1] %} diff --git a/formula10/templates/statistics.jinja b/formula10/templates/statistics.jinja index 95af4b8..3555f81 100644 --- a/formula10/templates/statistics.jinja +++ b/formula10/templates/statistics.jinja @@ -7,67 +7,78 @@ {% block body %}
    +
    + Note +
    +
    -
    Note
    Points from sprints and fastest laps are not tracked currently.
    -
    +
    +
    + Drivers +
    +
    -
    Drivers
    - - - - - - - - - - - - - {% for driver in points.drivers_sorted_by_points() %} - {% set driver_standing = points.wdc_standing_by_driver()[driver.name] %} - - - - - +
    +
    PlaceDriverPointsDNFs
    {{ driver_standing }}{{ driver.name }}{{ points.wdc_points()[driver.name] }}{{ points.dnfs()[driver.name] }}
    + + + + + + - {% endfor %} - -
    PlaceDriverPointsDNFs
    + + + + {% for driver in points.drivers_sorted_by_points() %} + {% set driver_standing = points.wdc_standing_by_driver()[driver.name] %} + + {{ driver_standing }} + {{ driver.name }} + {{ points.wdc_points()[driver.name] }} + {{ points.dnfs()[driver.name] }} + + {% endfor %} + + +
    -
    +
    +
    + Constructors +
    +
    -
    Constructors
    - - - - - - - - - - - - {% for team in points.teams_sorted_by_points() %} - {% set team_standing = points.wcc_standing_by_team()[team.name] %} - - - - +
    +
    PlaceTeamPoints
    {{ team_standing }}{{ team.name }}{{ points.wcc_points()[team.name] }}
    + + + + + - {% endfor %} - -
    PlaceTeamPoints
    + + + + {% for team in points.teams_sorted_by_points() %} + {% set team_standing = points.wcc_standing_by_team()[team.name] %} + + {{ team_standing }} + {{ team.name }} + {{ points.wcc_points()[team.name] }} + + {% endfor %} + + +
    diff --git a/formula10/templates/users.jinja b/formula10/templates/users.jinja index 1a73db1..6e083fa 100644 --- a/formula10/templates/users.jinja +++ b/formula10/templates/users.jinja @@ -7,9 +7,11 @@ {% block body %}
    -
    -
    Add User
    +
    + Add user +
    +
    @@ -26,9 +28,11 @@ {% if model.all_users() | length > 0 %}
    -
    -
    Registered Users
    +
    + Registered users +
    +
      {% for user in model.all_users() %}
    • {{ user.name }}
    • @@ -38,9 +42,11 @@
    -
    -
    Delete user
    +
    + Delete user +
    +