(balance) may set min and max values for transaction #33
Labels
No Label
🛃 types
👪 users
invalid
wontfix
🚀 announcement
🎒 backend
🐞 bug
🐋 docker
💡 enhancement
📺 frontend
🤔 question
🔗duplicate
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Flaschengeist/flaschengeist#33
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It is possible to create a transaction with very very small value e.g. 1e-8 or very big values e.g. 1e+8.
It is better to set max and min Values to create transaction.
Maybe 100 for max and 0.01 for min?
The bug is more deeper than expected. There is following behavior in backend.
If you set a transaction for 0.005€ your amount will be 0.01€
If you set a transaction for 0.004€ your amount will be 0.00€, but when you do it some more times your get an amount of 0.01€ and the databes says there was no amount.
The code of the transaction shows, there is a scale of 2, but the database save more than it shows.
To fix it, we have to check the amount can't lower than 0.01. Maybe sqlalchemy has a attribute for the database to fix it! (for backend)
In frontend we have to validate that the amount can't be lower than 0.01 in the input field.
Update:
With the scale of 2 in the database, it will simple round to the scale. So in the database is 0.004 a 0.00 and 0.005 a 0.01. This can be correct, maybe it is better always round up oder round down.
In the frontend when you do transaction, it calculate with the exact value, because it get only a ok or not ok from backend to save traffic.
It looks like your balance is higher or lower than expect. If you refresh the site the correct balance value from backend (with the database round priority) will be shown.
Because the minimum value to do a transaction should be 0.01 we have to say the database it should always floor the value to the scale size.
In frontend we have to validate the value like the comment before.
Can only do amounts of min 0.01 is fixed in commit 56b09abeaa441d38aacbf1bcdaeba0099ce6ef4a and
cab172dc65
But no max value of amount is set yet.