Skip to content

Commit

Permalink
Merge pull request #188 from communitiesuk/rounding
Browse files Browse the repository at this point in the history
Amend rounding to deal with negative numbers
  • Loading branch information
JamesC-MHCLG authored Jan 28, 2025
2 parents ba37198 + 0bc97b5 commit 129740d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions gov_uk_dashboards/formatting/rounding.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def round_thousands_to_1dp(value: float) -> float:
float: Rounded value
"""
try:
if value >= 1_000_000_000:
if value >= 1_000_000_000 or value <= -1_000_000_000:
return round(value, -8)
if value >= 1_000_000:
if value >= 1_000_000 or value <= -1_000_000:
return round(value, -5)
if value >= 1000:
if value >= 1000 or value <= -1_000:
return round(value, -2)
return round(value, 1)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
author="Department for Levelling Up, Housing and Communities",
description="Provides access to functionality common to creating a data dashboard.",
name="gov_uk_dashboards",
version="13.1.0",
version="13.2.0",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
Expand Down

0 comments on commit 129740d

Please sign in to comment.