diff --git a/scipost_django/colleges/migrations/0044_alter_fellowshipnominationdecision_outcome.py b/scipost_django/colleges/migrations/0044_alter_fellowshipnominationdecision_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..8525d26bf3a898c5cb025c7f26941543ddf03a30 --- /dev/null +++ b/scipost_django/colleges/migrations/0044_alter_fellowshipnominationdecision_outcome.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.18 on 2023-11-14 16:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('colleges', '0043_alter_fellowshipnominationevent_options'), + ] + + operations = [ + migrations.AlterField( + model_name='fellowshipnominationdecision', + name='outcome', + field=models.CharField(choices=[('elected', 'Elected'), ('notelected', 'Not elected'), ('inconclusive', 'Inconclusive')], max_length=16), + ), + ] diff --git a/scipost_django/colleges/models/nomination.py b/scipost_django/colleges/models/nomination.py index 95482e2251ab9b14afa55f61d0805ad91a32fe7b..1f289db9fdfe6f4296e52967945f39b8b34c6587 100644 --- a/scipost_django/colleges/models/nomination.py +++ b/scipost_django/colleges/models/nomination.py @@ -341,9 +341,11 @@ class FellowshipNominationDecision(models.Model): OUTCOME_ELECTED = "elected" OUTCOME_NOT_ELECTED = "notelected" + OUTCOME_INCONCLUSIVE = "inconclusive" OUTCOME_CHOICES = [ (OUTCOME_ELECTED, "Elected"), (OUTCOME_NOT_ELECTED, "Not elected"), + (OUTCOME_INCONCLUSIVE, "Inconclusive"), ] outcome = models.CharField(max_length=16, choices=OUTCOME_CHOICES) diff --git a/scipost_django/colleges/templates/colleges/_hx_nomination_voting_rounds_tab.html b/scipost_django/colleges/templates/colleges/_hx_nomination_voting_rounds_tab.html index 11fa485d7be94366c082acc79ae8157c3bdaa31c..a7a010ef01e561cd4e7c115a37489465f15cd9e6 100644 --- a/scipost_django/colleges/templates/colleges/_hx_nomination_voting_rounds_tab.html +++ b/scipost_django/colleges/templates/colleges/_hx_nomination_voting_rounds_tab.html @@ -7,6 +7,7 @@ type="button" class="me-2 px-2 nav-link border border-success" hx-get="{% url 'colleges:_hx_nomination_voting_rounds_create' nomination_id=nomination.id %}" + {% if nomination.decision.outcome == 'notelected' %}hx-confirm="Are you sure you want to create a new voting round for a previously non-elected nominee? This should only be performed as a rare exception and after considerable time has passed since the last round."{% endif %} hx-target="#nomination-{{ nomination.id }}-round-tab-holder" hx-swap="outerHTML"> <span class="fs-1 align-items-center text-success">+</span> diff --git a/scipost_django/colleges/templates/colleges/_hx_voting_round_details.html b/scipost_django/colleges/templates/colleges/_hx_voting_round_details.html index 1fab54c60cd3d7aed3b40dba734f480920404e6c..233591f87e1fc0132a6095f9ea3243216342067d 100644 --- a/scipost_django/colleges/templates/colleges/_hx_voting_round_details.html +++ b/scipost_django/colleges/templates/colleges/_hx_voting_round_details.html @@ -51,7 +51,7 @@ {% comment %} If round is closed show results if they exist {% endcomment %} {% else %} - <div>{% include "colleges/_voting_results_box.html" with voting_round=voting_round %}</div> + <div>{% include "colleges/_voting_results_box.html" with voting_round=round %}</div> {% if round.decision %} @@ -62,6 +62,8 @@ <div class="badge fs-5 mb-2 bg-success">{{ round.decision.get_outcome_display }}</div> {% elif round.decision.outcome == 'notelected' %} <div class="badge fs-5 mb-2 bg-danger">{{ round.decision.get_outcome_display }}</div> + {% elif round.decision.outcome == 'inconclusive' %} + <div class="badge fs-5 mb-2 bg-warning">{{ round.decision.get_outcome_display }}</div> {% endif %} {% if round.decision.comments %} diff --git a/scipost_django/colleges/templates/colleges/_hx_voting_round_summary.html b/scipost_django/colleges/templates/colleges/_hx_voting_round_summary.html index 119a04577893d38d18035df8513aabcc14c448de..257ce41ac6355c914e0eac4a04da91005b4f2e9e 100644 --- a/scipost_django/colleges/templates/colleges/_hx_voting_round_summary.html +++ b/scipost_django/colleges/templates/colleges/_hx_voting_round_summary.html @@ -66,12 +66,14 @@ <div class="col-auto"> - {% if round.decision.outcome == "elected" %} + {% if not round.decision %} + <span class="badge bg-warning">Pending</span> + {% elif round.decision.outcome == "elected" %} <span class="badge bg-success">{{ round.decision.get_outcome_display }}</span> {% elif round.decision.outcome == "notelected" %} <span class="badge bg-danger">{{ round.decision.get_outcome_display }}</span> - {% else %} - <span class="badge bg-warning">Pending</span> + {% elif round.decision.outcome == "inconclusive" %} + <span class="badge bg-warning">{{ round.decision.get_outcome_display }}</span> {% endif %} </div>