Fix Decimal precision issue

This commit is contained in:
tcprod 2025-02-07 18:57:07 +01:00
parent 9da25d4197
commit afe5575b34

View File

@ -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}"