1
1

handle calculating scale without values

This commit is contained in:
2020-02-18 16:15:13 +01:00
parent aadff671bd
commit cdd358903b

View File

@@ -96,7 +96,10 @@ def _floor_to_first_two_places(dec):
def _calculate_scale(stats):
max_amount = max(stat["amount"] for stat in stats.values() if stat["amount"] is not None)
amounts = [stat["amount"] for stat in stats.values() if stat["amount"] is not None]
if not amounts:
return 100
max_amount = max(amounts)
return _floor_to_first_two_places(max_amount * Decimal("1.3"))