Skip to content

Commit

Permalink
enable config to turn percentages expressed as 0.xx to xx.0
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Dec 16, 2024
1 parent faa78bc commit 7afbb2c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions hub/management/commands/import_from_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def setup(self, import_name, row):
else:
self.skip_delete = False

if row.get("multiply_percentage"):
self.multiply_percentage = True
else:
self.multiply_percentage = False

defaults = {}

comparators = row.get("comparators", None)
Expand Down Expand Up @@ -138,6 +143,13 @@ def get_dataframe(self):
df = df.astype({self.get_cons_col(): "str"})
return df

def get_row_data(self, row, conf):
value = super().get_row_data(row, conf)
if self.multiply_percentage:
value = value * 100

return value

def handle(
self,
quiet=False,
Expand Down

0 comments on commit 7afbb2c

Please sign in to comment.