diff --git a/locale/cy/LC_MESSAGES/django.po b/locale/cy/LC_MESSAGES/django.po index 0b88ee4f9..cb58f25a0 100644 --- a/locale/cy/LC_MESSAGES/django.po +++ b/locale/cy/LC_MESSAGES/django.po @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-01 17:19+0100\n" +"POT-Creation-Date: 2023-09-18 18:19+0100\n" "PO-Revision-Date: 2022-03-24 09:04+0000\n" "Last-Translator: Sym Roe , 2022\n" "Language-Team: Welsh (https://www.transifex.com/democracy-club/teams/61326/" @@ -29,21 +29,21 @@ msgstr "" msgid "Enter your postcode" msgstr "Rhowch eich cod post" -#: wcivf/apps/elections/models.py:656 +#: wcivf/apps/elections/models.py:672 msgid "First-past-the-post" msgstr "Y Cyntaf i’r Felin" -#: wcivf/apps/elections/models.py:658 +#: wcivf/apps/elections/models.py:674 #, fuzzy #| msgid "The Additional Member System" msgid "Additional Member System" msgstr "Y System Aelodau Ychwanegol" -#: wcivf/apps/elections/models.py:660 +#: wcivf/apps/elections/models.py:676 msgid "Supplementary Vote" msgstr "Pleidlais Atodol" -#: wcivf/apps/elections/models.py:662 +#: wcivf/apps/elections/models.py:678 msgid "Single Transferable Vote" msgstr "Pleidlais Sengl Drosglwyddadwy" @@ -752,7 +752,25 @@ msgstr "" "helpu i wella'r dudalen hon: ychwanegwch wybodaeth " "am ymgeiswyr i'n cronfa ddata." +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:130 +#, fuzzy +#| msgid "Elected" +msgid "Electorate" +msgstr "Etholwyd" + +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:133 +msgid "Turnout" +msgstr "Canran y Pleidleiswyr" + #: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:136 +msgid "Ballot Papers Issued" +msgstr "Nifer y Papurau Pleidleisio a Gyhoeddwyd" + +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:139 +msgid "Spoilt Ballots" +msgstr "Pleidleisiau Difetha" + +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:174 #, python-format msgid "" "The official candidate list has been published." @@ -760,32 +778,32 @@ msgstr "" "Mae'r rhestr swyddogol o ymgeiswyr wedi'i " "chyhoeddi." -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:141 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:179 msgid "The official candidate list should have been published on" msgstr "Dylai'r rhestr swyddogol o ymgeiswyr fod wedi'i chyhoeddi ar " -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:143 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:181 msgid "The official candidate list should be published on" msgstr "Dylai'r rhestr swyddogol o ymgeiswyr gael ei chyhoeddi ar" -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:151 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:189 msgid "Read the official candidate booklet for this election." msgstr "Darllenwch y llyfryn ymgeiswyr swyddogol ar gyfer yr etholiad hwn." -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:155 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:193 #, python-format msgid " %(description)s " msgstr " %(description)s " -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:163 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:201 msgid "Can you vote in this election?" msgstr "A allwch chi bleidleisio yn yr etholiad hwn?" -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:164 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:202 msgid "Age" msgstr "Oedran" -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:166 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:204 #, python-format msgid "" "You need to be over %(voter_age)s on the %(voter_age_date)s of " @@ -794,16 +812,16 @@ msgstr "" "Mae angen i chi fod dros %(voter_age)s ar %(voter_age_date)s " "%(election_date)s i bleidleisio yn yr etholiad hwn." -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:171 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:209 msgid "Citizenship" msgstr "Dinasyddiaeth" -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:191 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:229 #: wcivf/apps/people/templates/people/includes/_person_about_card.html:9 msgid "Wikipedia" msgstr "Wikipedia" -#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:193 +#: wcivf/apps/elections/templates/elections/includes/_single_ballot.html:231 #: wcivf/apps/people/templates/people/includes/_person_about_card.html:11 msgid "Read more on Wikipedia" msgstr "Darllenwch fwy ar Wikipedia" @@ -1784,11 +1802,6 @@ msgstr "" msgid "Position" msgstr "" -#: wcivf/apps/people/templates/people/includes/_person_previous_elections_card.html:25 -#, python-format -msgid "%(post_label)s: %(election)s" -msgstr "%(post_label)s: %(election)s" - #: wcivf/apps/people/templates/people/includes/intros/_constituency.html:5 #, python-format msgid "" @@ -1971,7 +1984,7 @@ msgstr "Llun proffil %(object.name)s" msgid "You are here:" msgstr "Rydych chi yma:" -#: wcivf/apps/people/templates/people/person_detail.html:58 +#: wcivf/apps/people/templates/people/person_detail.html:60 msgid "Back to candidates in" msgstr "Dychwelyd at ymgeiswyr yn" @@ -2173,6 +2186,26 @@ msgstr "Etholiadau i ddod" msgid "Join our mailing list" msgstr "Ymunwch â'n rhestr bostio" +#, fuzzy +#~| msgid "Elected (vote count not available)" +#~ msgid "Electorate not available" +#~ msgstr "Etholwyr ddim ar gael" + +#, fuzzy +#~| msgid "Elected (vote count not available)" +#~ msgid "Turnout not available" +#~ msgstr "Nid yw'r cyfrif pleidleisiau ar gael" + +#~ msgid "Number of ballot papers issued not available" +#~ msgstr "Nid yw nifer y papurau pleidleisio a roddwyd ar gael" + +#~ msgid "Number of spoilt ballots not available" +#~ msgstr "Nifer y pleidleisiau a ddifethwyd ddim ar gael" + +#, python-format +#~ msgid "%(post_label)s: %(election)s" +#~ msgstr "%(post_label)s: %(election)s" + #~ msgid "Where do I vote?" #~ msgstr "Ble rydw i'n pleidleisio?" diff --git a/wcivf/apps/elections/models.py b/wcivf/apps/elections/models.py index 1feea42f1..db2bd98ba 100644 --- a/wcivf/apps/elections/models.py +++ b/wcivf/apps/elections/models.py @@ -243,6 +243,18 @@ def pluralized_division_name(self): return pluralise.get(suffix, f"{suffix}s") + @property + def has_results(self): + """ + Returns a boolean for if the election has results + """ + return bool( + self.spoilt_ballots + or self.ballot_papers_issued + or self.turnout + or self.electorate + ) + class Post(models.Model): """ diff --git a/wcivf/apps/elections/templates/elections/includes/_single_ballot.html b/wcivf/apps/elections/templates/elections/includes/_single_ballot.html index 9780500bd..1af8d70d3 100644 --- a/wcivf/apps/elections/templates/elections/includes/_single_ballot.html +++ b/wcivf/apps/elections/templates/elections/includes/_single_ballot.html @@ -121,41 +121,40 @@

{% if postelection.is_london_assembly_additional %}{% trans "Additional memb {% endif %}

{% endif %} - {% if postelection.election.in_past %} + {% if postelection.election.in_past and postelection.election.has_results %}
- - - - + {% if postelection.election.electorate %} + + {% endif %} + {% if postelection.election.turnout %} + + {% endif %} + {% if postelection.election.ballot_papers_issued %} + + {% endif %} + {% if postelection.election.spoilt_ballots %} + + {% endif %} - {% endif %} - - {% endif %} - - {% endif %} - - {% endif %} -
ElectorateTurnoutBallot Papers IssuedSpoilt Ballots{% trans "Electorate" %}{% trans "Turnout" %} {% trans "Ballot Papers Issued" %}{% trans "Spoilt Ballots" %}
{% if postelection.election.electorate %} - {{ postelection.election.electorate }} - {% else %} - {% trans "Electorate not available" %} + {% if postelection.election.electorate %} + {{ postelection.election.electorate }}{% if postelection.election.turnout %} - {{ postelection.election.turnout|stringformat:"d%%" }} - {% else %} - {% trans "Turnout not available" %} + + {% if postelection.election.turnout %} + {{ postelection.election.turnout|stringformat:"d%%" }}{% if postelection.election.ballot_papers_issued %} - {{ postelection.election.ballot_papers_issued }} - {% else %} - {% trans "Number of ballot papers issued not available" %} + + {% if postelection.election.ballot_papers_issued %} + {{ postelection.election.ballot_papers_issued }}{% if postelection.election.spoilt_ballots %} - {{ postelection.election.spoilt_ballots }} - {% else %} - {% trans "Number of spoilt ballots not available" %} + + {% if postelection.election.spoilt_ballots %} + {{ postelection.election.spoilt_ballots }}
diff --git a/wcivf/apps/elections/tests/test_election_views.py b/wcivf/apps/elections/tests/test_election_views.py index d6c2498f9..0d5a2ac15 100644 --- a/wcivf/apps/elections/tests/test_election_views.py +++ b/wcivf/apps/elections/tests/test_election_views.py @@ -142,12 +142,18 @@ def test_results_table(self): """check that the table containing the electorate, turnout, spoilt ballots, ballot papers exist for past elections""" + today = str(datetime.today().date()) + self.election.electorate = 100 + self.election.spoilt_ballots = 5 + self.election.save() + response = self.client.get( self.post_election.get_absolute_url(), follow=True ) self.assertEqual(response.status_code, 200) - today = str(datetime.today().date()) + self.assertLess(self.election.election_date, today) + self.assertTrue(self.post_election.election.has_results) self.assertContains(response, "Electorate") self.assertContains(response, "Turnout") self.assertContains(response, "Spoilt Ballots")