Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when deleting a fine #2602

Closed
BadrAly opened this issue Dec 16, 2021 · 2 comments · Fixed by #2682
Closed

Error when deleting a fine #2602

BadrAly opened this issue Dec 16, 2021 · 2 comments · Fixed by #2682
Assignees
Labels
bug Breaks something but is not blocking effort: 3pt 3 point of effort estimated for the implementation f: circulation Concerns the circulation interface or backend p-Medium Medium priority (to be solved within 1-2 years)
Milestone

Comments

@BadrAly
Copy link

BadrAly commented Dec 16, 2021

Describe the bug

The following error message:

"payment creation failed!
[400 - undefined] Server error 8.2 is not a multiple of 0.01
"
appears when deleting the amount of "8.2" for a patron having fees equal or greater than "8.2" CHF

The transaction is successful if the amount of the fee is in the format "8.20" [two decimals]

To Reproduce

  1. Go to the admin interface
  2. Locate a patron having open fees
  3. Try to delete a fee for this patron
  4. Enter an amount with one decimal
  5. you see the error above
  • server: [bib.test.rero.ch][1] or [bib.rero.ch][2]
  • version: v1.7.0

Screenshot 2021-12-16 at 15 46 25

@BadrAly BadrAly added triage bug Breaks something but is not blocking labels Dec 16, 2021
@BadrAly
Copy link
Author

BadrAly commented Dec 16, 2021

Problem duplicated in console as well when creating an PatronTransactionEvent record


ValidationError: 8.2 is not a multiple of 0.01

Failed validating 'multipleOf' in schema['properties']['amount']:
    {'minimum': 0, 'multipleOf': 0.01, 'title': 'Amount', 'type': 'number'}

On instance['amount']:
    8.2

@BadrAly BadrAly added circulation and removed triage bug Breaks something but is not blocking labels Dec 16, 2021
@BadrAly BadrAly added this to the v1.8.0 milestone Dec 16, 2021
@pronguen pronguen added bug Breaks something but is not blocking p-Medium Medium priority (to be solved within 1-2 years) labels Dec 23, 2021
@zannkukai
Copy link
Contributor

According to multiple sources in the web, it's seems that a very bad idea to store decimal.

The easiest solution seems to store amount as cents counters instead of float => store 1025 instead of 10.25
Need a refactoring for the patron transactions but also for acquisition modules (second step ?)

@pronguen pronguen added f: circulation Concerns the circulation interface or backend and removed circulation labels Jan 17, 2022
@pronguen pronguen added the effort: 3pt 3 point of effort estimated for the implementation label Feb 2, 2022
@pronguen pronguen modified the milestones: v1.8.0, v1.9.0 Feb 2, 2022
@zannkukai zannkukai self-assigned this Feb 7, 2022
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 7, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 7, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 7, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 8, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 8, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 9, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 9, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Feb 9, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes rero#2602.

Co-Authored-by: Renaud Michotte <[email protected]>
pronguen pushed a commit that referenced this issue Feb 14, 2022
* Creates an extension to check if event amount contains a maximum of 2
  decimals.
* Reorganizing some codes from `PatronTransaction` resource to be more
  readable/usable.
* Closes #2602.

Co-Authored-by: Renaud Michotte <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Breaks something but is not blocking effort: 3pt 3 point of effort estimated for the implementation f: circulation Concerns the circulation interface or backend p-Medium Medium priority (to be solved within 1-2 years)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants