diff --git a/backend/hub/context_processors.py b/backend/hub/context_processors.py index 12fd7cc6..23f0b1a1 100644 --- a/backend/hub/context_processors.py +++ b/backend/hub/context_processors.py @@ -5,7 +5,7 @@ from django.urls import reverse from civil_society_vote.common.cache import cache_decorator -from hub.models import FLAG_CHOICES, FeatureFlag, SETTINGS_CHOICES +from hub.models import FLAG_CHOICES, FeatureFlag @cache_decorator(cache_key="hub_settings", timeout=settings.TIMEOUT_CACHE_SHORT) @@ -21,7 +21,10 @@ def hub_settings(_: HttpRequest) -> Dict[str, Any]: candidate_supporting_enabled = flags.get(FLAG_CHOICES.enable_candidate_supporting, False) candidate_voting_enabled = flags.get(FLAG_CHOICES.enable_candidate_voting, False) candidate_confirmation_enabled = flags.get(FLAG_CHOICES.enable_candidate_confirmation, False) + results_enabled = flags.get(FLAG_CHOICES.enable_results_display, False) + final_results_enabled = flags.get(FLAG_CHOICES.enable_final_results_display, False) + org_approval_enabled = flags.get(FLAG_CHOICES.enable_org_approval, False) org_editing_enabled = flags.get(FLAG_CHOICES.enable_org_editing, False) org_registration_enabled = flags.get(FLAG_CHOICES.enable_org_registration, False) @@ -44,13 +47,14 @@ def hub_settings(_: HttpRequest) -> Dict[str, Any]: "CANDIDATE_VOTING_ENABLED": candidate_voting_enabled, "CANDIDATE_CONFIRMATION_ENABLED": candidate_confirmation_enabled, "RESULTS_ENABLED": results_enabled, + "FINAL_RESULTS_ENABLED": final_results_enabled, "ORG_APPROVAL_ENABLED": org_approval_enabled, "ORG_EDITING_ENABLED": org_editing_enabled, "ORG_REGISTRATION_ENABLED": org_registration_enabled, # Settings flags - "GLOBAL_SUPPORT_ENABLED": flags.get(SETTINGS_CHOICES.global_support_round, False), - "VOTING_DOMAIN_ENABLED": flags.get(SETTINGS_CHOICES.enable_voting_domain, False), - "SINGLE_DOMAIN_ROUND": flags.get(SETTINGS_CHOICES.single_domain_round, False), + "GLOBAL_SUPPORT_ENABLED": flags.get(FLAG_CHOICES.global_support_round, False), + "VOTING_DOMAIN_ENABLED": flags.get(FLAG_CHOICES.enable_voting_domain, False), + "SINGLE_DOMAIN_ROUND": flags.get(FLAG_CHOICES.single_domain_round, False), # Composite flags "ELECTION_IN_PROGRESS": ( candidate_registration_enabled diff --git a/backend/hub/migrations/0079_alter_featureflag_flag.py b/backend/hub/migrations/0079_alter_featureflag_flag.py new file mode 100644 index 00000000..4bdebc42 --- /dev/null +++ b/backend/hub/migrations/0079_alter_featureflag_flag.py @@ -0,0 +1,40 @@ +# Generated by Django 4.2.16 on 2024-12-03 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("hub", "0078_candidatevote_organization"), + ] + + operations = [ + migrations.AlterField( + model_name="featureflag", + name="flag", + field=models.CharField( + choices=[ + ("enable_org_registration", "Enable organization registration"), + ("enable_org_editing", "Enable organization editing"), + ("enable_org_approval", "Enable organization approvals"), + ("enable_candidate_registration", "Enable candidate registration"), + ("enable_candidate_editing", "Enable candidate editing"), + ("enable_candidate_supporting", "Enable candidate supporting"), + ("enable_candidate_voting", "Enable candidate voting"), + ("enable_candidate_confirmation", "Enable candidate confirmation"), + ("enable_results_display", "Enable the display of results"), + ("enable_final_results_display", "Enable the display of results after resolving all complaints"), + ("single_domain_round", "Voting round with just one domain (some restrictions will apply)"), + ( + "global_support_round", + "Enable global support (the support of at least 10 organizations is required)", + ), + ("enable_voting_domain", "Enable the voting domain restriction for an organization"), + ], + max_length=254, + unique=True, + verbose_name="Flag", + ), + ), + ] diff --git a/backend/hub/models.py b/backend/hub/models.py index 632d40bf..a0bc6f46 100644 --- a/backend/hub/models.py +++ b/backend/hub/models.py @@ -113,6 +113,7 @@ def select_public_storage(): ("enable_candidate_voting", _("Enable candidate voting")), ("enable_candidate_confirmation", _("Enable candidate confirmation")), ("enable_results_display", _("Enable the display of results")), + ("enable_final_results_display", _("Enable the display of results after resolving all complaints")), ) SETTINGS_CHOICES = Choices( ("single_domain_round", _("Voting round with just one domain (some restrictions will apply)")), diff --git a/backend/hub/templates/hub/candidate/results.html b/backend/hub/templates/hub/candidate/results.html index 9b725379..7af24c67 100644 --- a/backend/hub/templates/hub/candidate/results.html +++ b/backend/hub/templates/hub/candidate/results.html @@ -53,9 +53,15 @@
+ {% if forloop.counter <= domain.seats %} -