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 14, 2023
1 parent e74d390 commit 7c39695
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions wcivf/apps/elections/import_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ 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_turnout_reported"
],
"electorate": ballot_dict["results"][
"total_electorate"
],
"turnout": ballot_dict["results"]["turnout_percentage"],
"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 7c39695

Please sign in to comment.