Fine generator can generate overdue fines beyond max-fine amount (rounding error)
Bug #1704819 reported by
Bill Erickson
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Fix Released
|
Medium
|
Unassigned | ||
3.1 |
Fix Released
|
Medium
|
Unassigned | ||
3.2 |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Evergreen 2.12 / affects all versions.
Seen in the wild:
1. Item is marked lost and $2.30 of overdue fines are voided.
2. Item is returned and a $2.30 "OVERDUES REINSTATED" billing is applied.
3. Additional $0.10 overdue fines are applied, totaling $3.10, with a max fine amount of $3.00.
In short, the fine generator should avoid use of int() for rounding:
% perl -e 'print int(100 * 2.30) . "\n"'
229
See also 'perldoc -f int'.
Simply removing the int() wrapper resolves the issue in a standalone test script. Note that we are using sprintf %.2f for creating new billings, so there is no danger of creating billings with meandering decimal values.
summary: |
Fine generator can generate overdue fines beyond max-fine amount - (rounding) + (rounding error) |
tags: | added: billing |
tags: | added: pullrequest |
Changed in evergreen: | |
assignee: | nobody → Dan Wells (dbw2) |
importance: | Undecided → Medium |
Changed in evergreen: | |
milestone: | none → 3.3-rc |
Changed in evergreen: | |
milestone: | 3.3-rc → 3.3.1 |
Changed in evergreen: | |
milestone: | 3.3.1 → 3.3.2 |
Changed in evergreen: | |
assignee: | Dan Wells (dbw2) → nobody |
Changed in evergreen: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Noting for reference the int() issue has come up before with credit card payments: bug #1282751.