Add ballot results
to ballot serializer
#2174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2172
Related to DemocracyClub/WhoCanIVoteFor#1685
The data I needed was already a part of
results_bot
process and theResultSet
model so I just needed to expose it the ballot serializer to be consumed by WCIVF.To test, find a locked ballot with results entered or manually enter and lock a ballot.
Navigate to
http://localhost:8000/api/next/ballots/local.st-albans.marshalswick-east-jersey-farm.by.2023-08-17/?format=json
for example, and you should see data similar to the block below at the end of your request:"results": { "num_turnout_reported": 300, "turnout_percentage": 7.5, "num_spoilt_ballots": 100, "source": "[google.com](http://google.com/)", "total_electorate": 4000 }