handle calculating scale without values
This commit is contained in:
@@ -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"))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user