From dfdd079ac4f395e9221bc3dd1a445d4d3a0f8a6e Mon Sep 17 00:00:00 2001 From: trotFunky Date: Thu, 25 Jul 2024 23:44:00 +0100 Subject: [PATCH] templates/truth: Prevent changing vote if not last week If the week is not active anymore, prevent changing any vote but allow adding missing ones. --- templates/truth.html.tera | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/truth.html.tera b/templates/truth.html.tera index dca3ffd..14df3e5 100644 --- a/templates/truth.html.tera +++ b/templates/truth.html.tera @@ -1,3 +1,9 @@ +{%- set is_disabled = "" -%} +{# If we are not during the active week, prevent changing vote but not sending a missing one. #} +{%- if week_data.is_last_week != true and user.votes | filter(attribute="truth_id", value=truth.id) -%} + {%- set is_disabled = "disabled" -%} +{%- endif -%} +

Vérité {{ truth.number }}

{{ truth.rendered_text | safe }}

@@ -8,10 +14,10 @@ Tu l'as fait :) {%- else -%} Qui l'a fait ? - {% for player in other_players %} - {# Check if we should pre-select an existing vote #} + {# Check if we should pre-select an existing vote. #} {% set_global is_selected = "" %} {% for vote in user.votes %} {% if truth.id == vote.truth_id and player.id == vote.voted_id %}