-
Notifications
You must be signed in to change notification settings - Fork 1
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
MPDX-7786 Don't round donations #833
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're already touching all the places where currency is formatted, we should be using currencyFormat
whenever we're dealing with money instead of manually appending the currency code like some components currently do.
src/components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/ExpectedMonthlyTotalReport/Header/ExpectedMonthlyTotalReportHeader.tsx
Outdated
Show resolved
Hide resolved
@canac In some places we want to have both the currency symbol and the currency code. For example: $10 USD. Other places we don't want the symbol in front of the number. Mainly because some countries don't have a symbol so it does this: UGX 10 UGX On places like the donation report and 14 month report, there isn't much space and the numbers get cut off when there is a currency with no symbol and it shows the currency code twice. I don't think there is a way to set the type to currency and then turn off the symbol. That is why I made formatCurrencyNoSymbol. |
src/components/Reports/FourteenMonthReports/Layout/Table/Table.tsx
Outdated
Show resolved
Hide resolved
@caleballdrin Sorry, I'm still a little confused.
Why is that? Why don't we just trust the browser to do this for us? Also, that looks fine for English but looks weird in locales that put the symbol after the amount, i.e.
Why don't we want it to display like this with only one symbol: 10 UGX?
I see your point about not putting symbols in the table because there's not much space, but I'm still confused why we'd display an amount like $10 USD (with both the symbol and the currency code). Is it to make extra clear which currency we mean because some amounts refer to foreign currencies? |
We don't have to have that I suppose. Americans are used to seeing the $ sign in front of money and that is the way it currently is. We could trust the browser, but there are certain places where we want to make it clear what the currency is. Since some currencies use the same symbol. So in most places we want the code 'USD' to distinguish and in other places it is not necessary so just the code is enough.
This is exactly the issue. We can't make something like
Yes, we want it to be clear when there are multiple currencies. Since some share the same symbol. |
If that's true, we definitely want to disambiguate like you're saying. But do you have an example? I know that, for example, USD and CAD are shown differently (e.g. $10 vs CA$10, respectively).
I'm suggesting letting the browser handle whether to put it in the front or at the end based on the ISO formatting rules for that currency.
I agree in theory, but I wasn't able to find any currencies that use the same symbol. Thanks for clarifying. I trust your judgement, so feel free to leave it the way you have it if you think that's best. It just seems more accurate to let the browser handle currency formatting the correct way for each currency instead of universally putting the symbol after the amount. I'm assuming that there aren't any ambiguous symbols since I used a script to check all currency codes listed here and none produced identical output after formatting. |
Feel free to use your approach if you prefer
When you click 'Add New Donation' the modal gives you the option to choose a currency. It shows both the currency code and the symbol. Many symbols use I wonder if we need to talk to someone higher up about this decision. Because it seems kind of weird that they haven't used the symbols all this time. And instead, they manually put the currency code. |
Good point about the new donation modal. Those options come from the server constants, which isn't based on the browser's i18n data. There are duplicates in those symbols, like you pointed out. Maybe we can ask Scott what he thinks at standup this afternoon. |
59d6e80
to
b6ffb55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Almost there!
...mponents/Reports/ExpectedMonthlyTotalReport/Header/ExpectedMonthlyTotalReportHeader.test.tsx
Outdated
Show resolved
Hide resolved
...components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.test.tsx
Show resolved
Hide resolved
...components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.test.tsx
Show resolved
Hide resolved
src/components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/PartnerGivingAnalysisReport/PartnerGivingAnalysisReport.test.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last comment from something I missed last time. Also, the test for the NaN case is failing.
src/components/Reports/ExpectedMonthlyTotalReport/ExpectedMonthlyTotalReport.test.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.test.tsx
Outdated
Show resolved
Hide resolved
cee1186
to
0b68dfb
Compare
...components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.test.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/ExpectedMonthlyTotalReport/ExpectedMonthlyTotalReport.test.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/DonationsReport/Table/DonationsReportTable.test.tsx
Outdated
Show resolved
Hide resolved
src/components/Reports/DonationsReport/Table/DonationsReportTable.test.tsx
Outdated
Show resolved
Hide resolved
...components/Reports/ExpectedMonthlyTotalReport/Table/ExpectedMonthlyTotalReportTable.test.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work pushing this across the finish line! 🎉
Description
https://jira.cru.org/browse/MPDX-7786
The donations should always be shown with 2 decimal places unless it's '.00' in which case it can just be rendered without any decimal places.
I think we could get away with only doing this fix on the New MPDX since we're hopefuilly moving away from the old version soon.
Example pages this will need to be fixed on:
Contacts donation
Donations page
Tools
Reports
Changes I made
Checklist: