Fix Decimal precision issue
This commit is contained in:
parent
9da25d4197
commit
afe5575b34
@ -67,8 +67,7 @@ class AccountingService:
|
||||
@staticmethod
|
||||
def make_euro_string_from_decimal(euros: Decimal) -> str:
|
||||
"""
|
||||
Internally, all money values are cents as ints. Only when showing them to the user we generate a string.
|
||||
Prevents float inaccuracy.
|
||||
Internally, all money values are euros as decimal. Only when showing them to the user we generate a string.
|
||||
"""
|
||||
rounded_decimal = str(euros.quantize(Decimal(".01"), rounding=ROUND_DOWN))
|
||||
return f"{rounded_decimal} €"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user