File tree Expand file tree Collapse file tree
src/onegov/election_day/collections
tests/onegov/election_day/views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -293,14 +293,23 @@ def update(
293293 result .name = request .app .principal .name
294294 result .date = item .date
295295 result .shortcode = item .shortcode
296- short_titles = {
297- k : v for k , v in (item .short_title_translations or {}).items () if v
298- }
299- result .title_translations = dict (
300- short_titles
301- or item .title_translations
302- or {}
303- )
296+
297+ # prioritize short title for elections, long title for votes
298+ if isinstance (item , Election ):
299+ short_titles = {
300+ k : v
301+ for k , v in (item .short_title_translations or {}).items ()
302+ if v
303+ }
304+ result .title_translations = dict (
305+ short_titles or item .title_translations or {}
306+ )
307+ else :
308+ result .title_translations = dict (
309+ item .title_translations
310+ or item .short_title_translations
311+ or {}
312+ )
304313 result .last_modified = item .last_modified
305314 result .last_result_change = item .last_result_change
306315 result .external_id = item .id
Original file line number Diff line number Diff line change @@ -1060,7 +1060,7 @@ def test_views_election_municipal_and_municipality(
10601060 assert 'Kommunale Wahlen und Abstimmungen' in goldach_page
10611061 assert 'Goldach' in goldach_page
10621062 assert 'Wahl' in goldach_page
1063- title = 'Ersatzwahl der Schulpräsidentin/des Schulpräsidenten'
1063+ title = 'Wahl Schulpräsidium' # short title
10641064 assert title in goldach_page
1065- assert (goldach_page .click ('Ersatzwahl der Schulpräsidentin' ).
1065+ assert (goldach_page .click (title ).
10661066 maybe_follow ().status_code == 200 )
You can’t perform that action at this time.
0 commit comments