fix-amount-conversion #87
No reviewers
Labels
No Label
ussd/user-reported
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: grassrootseconomics/sarafu-vise#87
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix-amount-conversion"
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?
Add tests of 18 d.p. to TestParseAndScaleAmount and for the menu handler itself.
Generally the following should be the behaviour:
1.85 inputted for a 18d.p token - > 1850000000000000000
1.8599999999 inputted for a 18 d.p. token -> 1850000000000000000 (we truncate anything after 2 d.p.)
2.32 inputted for a 6 d.p token -> 2320000
This has been fixed.
TruncateDecimalString
has been added as a helper function to truncate the amounts to whichever specified d.p. This has been set to 2 in the menuhanlderParseAndScaleAmount
func will be called after the amount has been truncated to the specified d.p.