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

In the pro patron account, some paid fees still appear. #1373

Closed
pronguen opened this issue Nov 4, 2020 · 5 comments · Fixed by #1404
Closed

In the pro patron account, some paid fees still appear. #1373

pronguen opened this issue Nov 4, 2020 · 5 comments · Fixed by #1404
Assignees
Labels
bug Breaks something but is not blocking f: circulation Concerns the circulation interface or backend f: professional ui Professional interface

Comments

@pronguen
Copy link
Contributor

pronguen commented Nov 4, 2020

Describe the bug

In the pro interface, patron account, tab Fees, some paid fees still appear.

To Reproduce

  1. [Diagnostic wanted, it was impossible to reproduce]

Expected behavior

The paid fees should appear only in the fee history.

Context

  • server: ilspilot.test.rero.ch
  • version: v0.12.0

Proposed by the pilot libraries

Screenshots

image

@pronguen pronguen added triage bug Breaks something but is not blocking labels Nov 4, 2020
@iGormilhit
Copy link

@zannkukai It reminds me something, such as a PR that you proposed. Does it ring a bell to you? 🔔

@iGormilhit iGormilhit added f: circulation Concerns the circulation interface or backend f: professional ui Professional interface and removed triage labels Nov 5, 2020
@zannkukai
Copy link
Contributor

@iGormilhit it seems not be linked. Subscriptions creation and transactions management come from 2 distinct modules.

@zannkukai
Copy link
Contributor

For dark reasons some payment are not corresponding to the total amount.
So the total due is not equals to 0 and the system consider this transaction as Open (no problem on backend).
For this transaction the total due is still "4.996003610813204e-16" CHF (you can see it, clicking on "pay all" action button

image

The problem is now : how to know how this strange amount is has been placed ?

image

Simple solution : click on "pay all" to create an new payment event and closed the transaction.

@zannkukai zannkukai self-assigned this Nov 5, 2020
@pronguen
Copy link
Contributor Author

pronguen commented Nov 5, 2020

@zannkukai
The problem was probably that a payment was done partially

  • Example: fee CHF 0.20
  • Payment: CHF 0.199
  • Remaining fee: CHF 0.00 (rounded)

Solution: prevent to pay an amount with 3 digits after comma? Would it be possible?

@zannkukai
Copy link
Contributor

Problem found ! It's due to bit reprsentation of real number in python

$ python
Python 2.7.12 (default, Jul 21 2020, 15:19:50) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 10 - 9.54
0.46000000000000085
>>> 

zannkukai added a commit to zannkukai/rero-ils that referenced this issue Nov 5, 2020
The bit representation of real number
(https://en.wikipedia.org/wiki/IEEE_754) cause problem with arithmetic
operation on them (10-9.54 = 0.460000000000085). This commit fixes this
problem by multiplying transaction amount by 100 and cast them into
integer when arithmetic operations are done.

Closes rero#1373

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Nov 5, 2020
The bit representation of real number
(https://en.wikipedia.org/wiki/IEEE_754) cause problem with arithmetic
operation on them (10-9.54 = 0.460000000000085). This commit fixes this
problem by multiplying transaction amount by 100 and cast them into
integer when arithmetic operations are done.

Closes rero#1373

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
zannkukai added a commit to zannkukai/rero-ils that referenced this issue Nov 6, 2020
The bit representation of real number
(https://en.wikipedia.org/wiki/IEEE_754) cause problem with arithmetic
operation on them (10-9.54 = 0.460000000000085). This commit fixes this
problem by multiplying transaction amount by 100 and cast them into
integer when arithmetic operations are done.

Closes rero#1373

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
zannkukai added a commit that referenced this issue Nov 9, 2020
The bit representation of real number
(https://en.wikipedia.org/wiki/IEEE_754) cause problem with arithmetic
operation on them (10-9.54 = 0.460000000000085). This commit fixes this
problem by multiplying transaction amount by 100 and cast them into
integer when arithmetic operations are done.

Closes #1373

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
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 f: circulation Concerns the circulation interface or backend f: professional ui Professional interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants