okTurtles / group-income

A decentralized and private (end-to-end encrypted) financial safety net for you and your friends.
https://groupincome.org
GNU Affero General Public License v3.0
331 stars 44 forks source link

Pledges should be displayed in decimal notation #2281

Open dotmacro opened 3 months ago

dotmacro commented 3 months ago

Problem

On testing, regardless of how the user enters a pledge of ".0000002 BTC", after the pledge is saved, the UI displays it as "2e-7".

pledge--scientificNotation

Solution

Pledges should be displayed in decimal notation. Testing didn't uncover other instances of this issue, but all numbers should be displayed in decimal notation. NOTE: The UI allows the user to enter "2e-7" as a pledge. This is not a problem, but it's also OK to require the user to enter a pledge in decimal notation if that's required to solve this issue.

snowteamer commented 1 month ago

@dotmacro I couldn't reproduce this issue, as the app only supports USD as group currency on my end. How can I change the group currency?

Regardless, the UI does allow exponential notation in USD pledges, whereas the decimal notation is restricted to only two decimal places after the dot. Therefore, exponential notation allows entering amounts which are otherwise rejected as invalid in decimal notation. Other parts of the UI will then round and report the amount in decimal notation, e.g. 6e-3 USD is displayed as $0.01, which is not exactly the same amount.

Not sure if this can become a problem though.

dotmacro commented 1 week ago

@snowteamer Sorry for missing your question! The app doesn't support changing currency anymore (that was a recent PR). However, you can choose USD, EUR, or BTC as the default group currency when creating a group.

I sent you an invite link to a BTC mincome group via DM.

Other parts of the UI will then round and report the amount in decimal notation, e.g. 6e-3 USD is displayed as $0.01, which is not exactly the same amount.

Good catch! I don't think this is a big problem because a) few users are likely to enter numbers in exponential notation; b) in most currencies, the rounding is a very small amount; c) the smallest amount users can send/receive for most payments is also the smallest unit displayed in decimal notation. I've created a new issue for that: #2409