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

Feature/add more election results data #1685

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

VirginiaDooley
Copy link
Contributor

@VirginiaDooley VirginiaDooley commented Aug 24, 2023

Closes #935 and #1663
Dependent on DemocracyClub/yournextrepresentative#2174

This work adds election results for past elections, when results are available.

  • Add turnout, ballot papers issues, electorate and spoilt ballots to Election model
  • Display ^^ results data in a new table on the ballot template as shown below, only when they exist
  • Add Welsh translations
  • Import this data as part of the import_ballots process
  • Add election results to YNR ballot serializer
  • Switches candidate lists to a single column

To test:

  • run migrations
  • run the ballot importer for recent elections with python manage.py import_ballots --current
  • visit a recently past election with results to view a new table similar to the one shown below

Screenshot 2023-09-19 at 4 41 03 PM

Screenshot 2023-09-19 at 4 41 19 PM


@coveralls
Copy link

coveralls commented Aug 24, 2023

Coverage Status

coverage: 61.513% (+0.04%) from 61.476% when pulling 36ac9ea on feature/add-turnout-and-spoilt-ballots into 82d9834 on master.

@VirginiaDooley VirginiaDooley changed the title Feature/add turnout and spoilt ballots WIP Feature/add turnout and spoilt ballots Aug 24, 2023
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch 9 times, most recently from f9d6915 to d0a73e6 Compare September 6, 2023 11:43
@VirginiaDooley VirginiaDooley changed the title WIP Feature/add turnout and spoilt ballots Feature/add turnout and spoilt ballots Sep 12, 2023
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch 2 times, most recently from 7e678c6 to a239152 Compare September 13, 2023 13:16
@VirginiaDooley VirginiaDooley marked this pull request as ready for review September 13, 2023 13:16
@VirginiaDooley VirginiaDooley self-assigned this Sep 13, 2023
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from c4fb128 to b3a231c Compare September 13, 2023 15:19
@VirginiaDooley
Copy link
Contributor Author

@pmk01 Would you prefer the table not appear at all if results are not available? Or should it read, as is the case currently, eg "Electorate not available"?

@VirginiaDooley
Copy link
Contributor Author

VirginiaDooley commented Sep 13, 2023

@symroe This works well with current ballots, but for a full import, I hit an issue with formatting. For example: https://candidates.democracyclub.org.uk/api/next/results/local.reading.norcot.by.2023-08-03/ which points to an issue with the way I've formatted it in the serializer or the way it's arriving via resultsbot

@VirginiaDooley VirginiaDooley changed the title Feature/add turnout and spoilt ballots Feature/add more election results data Sep 14, 2023
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from 8f87d45 to b933119 Compare September 14, 2023 08:30
@pmk01
Copy link
Contributor

pmk01 commented Sep 14, 2023

@pmk01 Would you prefer the table not appear at all if results are not available? Or should it read, as is the case currently, eg "Electorate not available"?

We should not show the table until we have some results.

It will be common for us to lack some numbers. It's often the case that councils only publish turnout percentage and nothing else, for example. We could just leave the field blank if we don't have the number? I think this is preferable to "[thing] not available".

@VirginiaDooley
Copy link
Contributor Author

@pmk01 Would you prefer the table not appear at all if results are not available? Or should it read, as is the case currently, eg "Electorate not available"?

We should not show the table until we have some results.

It will be common for us to lack some numbers. It's often the case that councils only publish turnout percentage and nothing else, for example. We could just leave the field blank if we don't have the number? I think this is preferable to "[thing] not available".

I think we have to have something in the box if a data point isn't available - if nothing else to maintain the formatting of the table, is "None" ok?

@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from 78c2f4a to b4d20ae Compare September 14, 2023 12:40
@VirginiaDooley
Copy link
Contributor Author

@pmk01 Would you prefer the table not appear at all if results are not available? Or should it read, as is the case currently, eg "Electorate not available"?

We should not show the table until we have some results.
It will be common for us to lack some numbers. It's often the case that councils only publish turnout percentage and nothing else, for example. We could just leave the field blank if we don't have the number? I think this is preferable to "[thing] not available".

I think we have to have something in the box if a data point isn't available - if nothing else to maintain the formatting of the table, is "None" ok?

This is done with b4d20ae

@pmk01
Copy link
Contributor

pmk01 commented Sep 15, 2023

Sorry, no, 'none' wouldn't work becuase turnout: "none" doesn't make any sense. If we have nothing at all, does the column disappear? I am fine with that if the case.

@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from c15f952 to 9b92864 Compare September 18, 2023 17:23
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch 2 times, most recently from 3cec448 to 44d08c0 Compare September 18, 2023 17:31
@symroe
Copy link
Member

symroe commented Sep 19, 2023

Sorry to throw a spanner in the works late on, but would it be better for the table to be flopped 90°?

So we have

a: 1
b: 2
c: 3

rather than

a    b    c
1    2    3

Thinking about mobile interfaces mostly,

@VirginiaDooley

This comment was marked as resolved.

@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch 5 times, most recently from f961b23 to b39ab27 Compare September 19, 2023 15:40
symroe

This comment was marked as resolved.

@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch 2 times, most recently from 719288e to 05e5560 Compare September 21, 2023 15:36
self.spoilt_ballots
or self.ballot_papers_issued
or self.turnout
or self.electorate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what you suggested? @symroe

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as outdated.

@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from 05e5560 to fd3aff0 Compare September 21, 2023 15:37
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch 4 times, most recently from 587e8b1 to db3334c Compare September 26, 2023 08:08
- Includes turnout (ballot_papers_issued),
electorate, percentage turnout and spoilt ballots
- Add more results data to Election model
- Display election results in table when it exists
@VirginiaDooley VirginiaDooley force-pushed the feature/add-turnout-and-spoilt-ballots branch from db3334c to 36ac9ea Compare September 26, 2023 08:38
@VirginiaDooley VirginiaDooley merged commit b29b510 into master Sep 26, 2023
1 check 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.

Display turnout & spoilt ballot info
4 participants