Skip to content

Conversation

@BLEMENT33
Copy link
Contributor

Description

I change all the amounts in cents (integer) to avoid rounding issues.

@BLEMENT33 BLEMENT33 linked an issue Mar 15, 2024 that may be closed by this pull request
amount_raised = int(sum(
[ticket.pack_ticket.price / ticket.pack_ticket.pack_size for ticket in tickets]
)
))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this PR is to avoid imprecision errors. Maybe there is a way to avoid dividing values before converting to int

@guillaumetavernier
Copy link
Contributor

Nice one ! You will need to look into migration files to convert float euro database values to new int cent values

@codecov
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.26%. Comparing base (f231edc) to head (f1a966a).
Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #366   +/-   ##
=======================================
  Coverage   78.26%   78.26%           
=======================================
  Files          76       76           
  Lines        5351     5351           
=======================================
  Hits         4188     4188           
  Misses       1163     1163           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@armanddidierjean armanddidierjean added bug Something isn't working amap tombola labels Mar 19, 2024
@armanddidierjean
Copy link
Member

armanddidierjean commented Apr 10, 2025

Partially superceded by #686 for AMAP module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

amap bug Something isn't working tombola

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use integer cents in AMAP / Tombola

4 participants