Skip to content

Commit

Permalink
lib360dataquality: Regression on incorrectly rounded value
Browse files Browse the repository at this point in the history
Since it was rounding to the nearest int on a value range between
0.0-1.0 this was pushing the value to 0 incorrectly. Remove this
rounding and leave it to the data presentation in templates etc.

Fixes: #93
  • Loading branch information
michaelwood committed Nov 22, 2023
1 parent ed79be3 commit 82da89c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib360dataquality/cove/threesixtygiving.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,7 @@ def get_heading_count(self, test_class_type):
if total < 1:
total = 1

self.grants_percentage = round(self.count / total, 1)
heading_percentage = "{:.0%}".format(self.grants_percentage)
self.grants_percentage = self.count / total

# Return conditions

Expand All @@ -574,10 +573,11 @@ def get_heading_count(self, test_class_type):
self.grants_percentage = 1.0
return f"1 {self.relevant_grant_type}".strip()

if self.count < 5:
if self.count <= 5:
return f"{self.count} {self.relevant_grant_type}".strip()

return f"{heading_percentage} of {self.relevant_grant_type}".strip()
heading_percentage = "{:.0%}".format(self.grants_percentage)
return f"{heading_percentage} ({self.count}) of {self.relevant_grant_type}".strip()

def format_heading_count(self, message, test_class_type=None, verb="have"):
"""Build a string with count of grants plus message
Expand Down

0 comments on commit 82da89c

Please sign in to comment.