Skip to content

Commit

Permalink
Merge branch 'master' into feature/update-stamp-price
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschuppi81 committed Jan 6, 2025
2 parents 746eb1d + 4cbd81a commit 04558cd
Show file tree
Hide file tree
Showing 159 changed files with 52,323 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/onegov/election_day/models/principal.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ def __init__(
with (path / '{}.json'.format(canton)).open('r') as f:
entities[year] = {int(k): v for k, v in json.load(f).items()}

# NOTE: this section may depend on static data for principle.entities.
# See src/onegov/election_day/static/municipalities/<year>/*.json
if date.today().year not in entities:
print(f'Warning: No entities for year {date.today().year} found '
f'for {canton}')

# Test if all entities have districts (use none, if ambiguous)
districts = {
entity.get('district', None)
Expand Down Expand Up @@ -437,6 +443,12 @@ def __init__(
for year in range(2002, date.today().year + 1)
}

# NOTE: this section may depend on static data for principle.entities.
# See src/onegov/election_day/static/municipalities/<year>/*.json
if date.today().year not in entities:
print(f'Warning: No entities for year {date.today().year} found '
f'for {municipality}')

super().__init__(
id_=municipality,
domain='municipality',
Expand Down
Loading

0 comments on commit 04558cd

Please sign in to comment.