mysociety / caps

A simple, open database of local government climate action plan documents and emissions data.
https://cape.mysociety.org
Other
9 stars 2 forks source link

Avoid displaying ".0" decimals on question marks #702

Closed zarino closed 3 weeks ago

zarino commented 3 weeks ago

Fixes #699. The question, as outlined there, is:

Can the number of marks a council got on a question ever be a fraction with more than one decimal place? And if it can, do we care if it gets rounded to one decimal place?

If the answer to either of those questions is "no" then we should be good to merge this PR.

lucascumsille commented 3 weeks ago

Thanks @zarino I'm checking with CEUK if that would be a problem.

zarino commented 3 weeks ago

@lucascumsille this PR now includes a custom Django template filter that does what you’d expect:

Raw mark Displayed as
0 0
0.0 0
1 1
1.0 1
1.1 1.1
1.10 1.1
1.25 1.25
1.250 1.25
-0.1 -0.1
-0.12 -0.12
-0.125 -0.125

If you’re happy, feel free to squash the commits, merge, and deploy.