Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ballot results to ballot serializer #2174

Merged
merged 4 commits into from
Sep 12, 2023

Conversation

VirginiaDooley
Copy link
Contributor

@VirginiaDooley VirginiaDooley commented Sep 7, 2023

Closes #2172
Related to DemocracyClub/WhoCanIVoteFor#1685
The data I needed was already a part of results_bot process and the ResultSet 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 }


@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from 07fe731 to 3476352 Compare September 11, 2023 14:44
@VirginiaDooley VirginiaDooley marked this pull request as ready for review September 11, 2023 14:44
@VirginiaDooley VirginiaDooley changed the title WIP add result_set to ballot serializer Add result_set to ballot serializer Sep 11, 2023
@VirginiaDooley VirginiaDooley changed the title Add result_set to ballot serializer Add ballot results to ballot serializer Sep 11, 2023
@symroe
Copy link
Member

symroe commented Sep 12, 2023

Sorry, one more thing. The API docs don't look great:
image

@symroe
Copy link
Member

symroe commented Sep 12, 2023

I think you need to add ref_name = None # Tells swagger that this is always embedded to the MinimalResultSerializer (see example in CandidateResultSerializer)

@VirginiaDooley VirginiaDooley merged commit 8b83d78 into master Sep 12, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import more results data
2 participants