Skip to content

Commit

Permalink
Change the display of candidates if results are not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Dec 3, 2024
1 parent 93ec9c3 commit af99875
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
6 changes: 6 additions & 0 deletions backend/hub/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ def flags_phase_pause(self, request, __: QuerySet[FeatureFlag]):
"enable_candidate_confirmation",
"enable_candidate_voting",
"enable_results_display",
"enable_pending_results",
"enable_final_results_display",
],
)
Expand All @@ -755,6 +756,7 @@ def flags_phase_deactivate(self, request, __: QuerySet[FeatureFlag]):
"enable_candidate_confirmation",
"enable_candidate_voting",
"enable_results_display",
"enable_pending_results",
"enable_final_results_display",
],
)
Expand All @@ -777,6 +779,7 @@ def flags_phase_1(self, request, __: QuerySet[FeatureFlag]):
"enable_candidate_confirmation",
"enable_candidate_voting",
"enable_results_display",
"enable_pending_results",
"enable_final_results_display",
],
)
Expand All @@ -799,6 +802,7 @@ def flags_phase_2(self, request, __: QuerySet[FeatureFlag]):
"enable_candidate_supporting",
"enable_candidate_voting",
"enable_results_display",
"enable_pending_results",
"enable_final_results_display",
],
)
Expand All @@ -821,6 +825,7 @@ def flags_phase_3(self, request, __: QuerySet[FeatureFlag]):
"enable_candidate_supporting",
"enable_candidate_confirmation",
"enable_results_display",
"enable_pending_results",
"enable_final_results_display",
],
)
Expand All @@ -843,6 +848,7 @@ def flags_final_phase(self, request, __: QuerySet[FeatureFlag]):
"enable_candidate_supporting",
"enable_candidate_voting",
"enable_candidate_confirmation",
"enable_pending_results",
"enable_final_results_display",
],
)
Expand Down
41 changes: 41 additions & 0 deletions backend/hub/migrations/0080_alter_featureflag_flag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 4.2.16 on 2024-12-03 22:02

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("hub", "0079_alter_featureflag_flag"),
]

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_pending_results", "Enable the phase when waiting for the display of results"),
("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",
),
),
]
1 change: 1 addition & 0 deletions backend/hub/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def select_public_storage():
("enable_candidate_supporting", _("Enable candidate supporting")),
("enable_candidate_voting", _("Enable candidate voting")),
("enable_candidate_confirmation", _("Enable candidate confirmation")),
("enable_pending_results", _("Enable the phase when waiting for the display of results")),
("enable_results_display", _("Enable the display of results")),
("enable_final_results_display", _("Enable the display of results after resolving all complaints")),
)
Expand Down
4 changes: 3 additions & 1 deletion backend/hub/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,9 @@ def get_candidates_pending(cls):
)

def get_qs(self):
if FeatureFlag.flag_enabled(PHASE_CHOICES.enable_candidate_voting):
if FeatureFlag.flag_enabled(PHASE_CHOICES.enable_candidate_voting) or FeatureFlag.flag_enabled(
PHASE_CHOICES.enable_pending_results
):
return self.get_candidates_to_vote()

if FeatureFlag.flag_enabled(PHASE_CHOICES.enable_results_display):
Expand Down

0 comments on commit af99875

Please sign in to comment.