Skip to content

Commit

Permalink
Import more data from results
Browse files Browse the repository at this point in the history
  • Loading branch information
VirginiaDooley committed Sep 13, 2023
1 parent f592e0e commit a239152
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions wcivf/apps/elections/import_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,26 @@ def update_or_create_from_ballot_dict(self, ballot_dict):
},
)

if ballot_dict["results"]:
election, created = Election.objects.update_or_create(
slug=slug,
election_type=election_type,
defaults={
"ballot_papers_issued": ballot_dict["results"][
"num_ballot_papers"
],
"electorate": ballot_dict["results"][
"total_electorate"
],
"turnout": ballot_dict["results"][
"num_turnout_reported"
],
"spoilt_ballots": ballot_dict["results"][
"num_spoilt_ballots"
],
},
)

self.import_metadata_from_ee(election)
self.election_cache[election.slug] = election
return self.election_cache[slug]
Expand Down

0 comments on commit a239152

Please sign in to comment.