Skip to content

Commit

Permalink
Election Day: Election results shown as pending as long as election n…
Browse files Browse the repository at this point in the history
…ot completed/final

Note: No model or api adaption done

TYPE: Feature|
LINK: ogc-1939
  • Loading branch information
Tschuppi81 authored Dec 17, 2024
1 parent 7e4076f commit 7663a13
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
exclude: .pre-commit-config.yaml
- id: pt_structure
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.8.3
hooks:
- id: ruff
args: [ "--fix" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,9 @@ msgstr "Ja"
msgid "No"
msgstr "Nein"

msgid "Pending"
msgstr "Pendent"

msgid "All candidates"
msgstr "Alle Kandidierenden"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,9 @@ msgstr "Oui"
msgid "No"
msgstr "Non"

msgid "Pending"
msgstr "On cours"

msgid "All candidates"
msgstr "Tous les candidats"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,9 @@ msgstr "Si"
msgid "No"
msgstr "No"

msgid "Pending"
msgstr "In attesa"

msgid "All candidates"
msgstr "Tutti i candidati"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,9 @@ msgstr "Gea"
msgid "No"
msgstr "Na"

msgid "Pending"
msgstr "Pendent"

msgid "All candidates"
msgstr "Tut las candidatas e candidats"

Expand Down
5 changes: 3 additions & 2 deletions src/onegov/election_day/templates/macros.pt
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,9 @@
<td tal:condition="layout.majorz" class="column-party right-aligned">${candidate.party}</td>
<td tal:condition="layout.proporz" class="column-list right-aligned">${candidate.list_name}</td>
<td tal:condition="layout.majorz and show_percentage" class="column-votes-percentage right-aligned">${layout.format_number(candidate.percentage, 1)}%</td>
<td class="column-elected answer accepted right-aligned" tal:condition="candidate.elected is True" i18n:translate="">Yes</td>
<td class="column-elected answer rejected right-aligned" tal:condition="candidate.elected is False" i18n:translate="">No</td>
<td class="column-elected answer accepted right-aligned" tal:condition="election.completed and candidate.elected is True" i18n:translate="">Yes</td>
<td class="column-elected answer rejected right-aligned" tal:condition="election.completed and candidate.elected is False" i18n:translate="">No</td>
<td class="column-elected answer right-aligned" tal:condition="not election.completed" i18n:translate="">Pending</td>
<td class="column-elected answer right-aligned" tal:condition="candidate.elected is None" i18n:translate=""></td>
</tr>
</tal:block>
Expand Down
2 changes: 1 addition & 1 deletion tests/onegov/election_day/models/test_election.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def test_election_status(session):
session.flush()
assert election.status is None

# Test completed calcuation
# Test completed calculation
# ... empty election
for status, completed in (
(None, False), ('unknown', False), ('interim', False), ('final', True)
Expand Down
28 changes: 23 additions & 5 deletions tests/onegov/election_day/views/test_views_election.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,22 @@ def test_view_election_candidates(election_day_app_gr):

login(client)

# Majorz election
# Majorz election intermediate results
upload_majorz_election(client, status='interim')

# ... main
candidates = client.get('/election/majorz-election/candidates')
assert all((expected in candidates for expected in (
"Engler Stefan", "20", "Pendent", "Schmid Martin", "18", "Pendent"
)))

# Majorz election final results
upload_majorz_election(client, status='final')

# ... main
candidates = client.get('/election/majorz-election/candidates')
assert all((expected in candidates for expected in (
"Engler Stefan", "20", "Schmid Martin", "18"
"Engler Stefan", "20", "Ja", "Schmid Martin", "18", "Ja"
)))

# ... bar chart data (with filters)
Expand Down Expand Up @@ -78,7 +87,7 @@ def test_view_election_candidates(election_day_app_gr):
)
assert 'entity=Filisur' in chart

# ... ebmedded table (with filters)
# ... embedded table (with filters)
table = client.get('/election/majorz-election/candidates-table')
assert 'data-text="20"' in table

Expand All @@ -92,13 +101,22 @@ def test_view_election_candidates(election_day_app_gr):
)
assert 'data-text=' not in table

# Proporz election
# Proporz election intermediate results
upload_proporz_election(client, status='interim')

# ....main
candidates = client.get('/election/proporz-election/candidates')
assert all((expected in candidates for expected in (
"Caluori Corina", "1", "Pendent", "Casanova Angela", "0", "Pendent"
)))

# Proporz election final results
upload_proporz_election(client, status='final')

# ....main
candidates = client.get('/election/proporz-election/candidates')
assert all((expected in candidates for expected in (
"Caluori Corina", "1", "Casanova Angela", "0"
"Caluori Corina", "1", "Nein", "Casanova Angela", "0", "Nein"
)))

# ... bar chart data (with filters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_upload_election_compound_temporary_results(election_day_app_gr):
(0, 1) # compound
]

# Onegov internal: misssing and number of municpalities
# Onegov internal: missing and number of municipalities
csv = '\n'.join((
(
'election_status,'
Expand Down

0 comments on commit 7663a13

Please sign in to comment.