DemocracyClub / yournextrepresentative

👥 A website for crowd-sourcing structured election candidate data
https://candidates.democracyclub.org.uk
GNU Affero General Public License v3.0
21 stars 27 forks source link

Error submitting results with a decimal value #2300

Open sjorford opened 4 months ago

sjorford commented 4 months ago

Copying and pasting the results from https://www.wokingham.gov.uk/council-and-meetings/elections-and-voting/local-government-and-pcc-election-results-2024 and some of the values have a typo - they have "." instead of a "," as the thousands separator: image

This causes a 500 error when submitting the form - although the values (with both . and ,) seem to pass the form validation - using just commas seems to work fine image

The validation regex pattern="[0-9\s\.,]*" for the vote fields allows a decimal point - removing this should fix the issue

sjorford commented 2 months ago

This fix has broken entry of turnout percentages with decimals - e.g. trying to fix the votes on https://candidates.democracyclub.org.uk/uk_results/local.adur.hillside.2021-05-06/ image

The source at https://www.adur-worthing.gov.uk/elections-and-voting/election-results/2021/#adc only has a turnout percentage, not total turnout and electorate - to fix the votes I would have to edit the existing turnout percentage to remove the decimals