Closed lanitochka17 closed 3 months ago
Triggered auto assignment to @CortneyOfstad (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
@CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
We think that this bug might be related to #wave-collect - Release 1
BE returns negative tax amount when editing tax amount manually. And we convert the negative tax amount to formatted tax amount here in MoneyRequestConfimationListFooter
without first converting the tax amount into positive value as we do in MoneyRequestView.
https://github.com/Expensify/App/blob/937c4186409725b57fdaae6ae8e1d8c85a9d52a0/src/components/MoneyRequestConfirmationListFooter.tsx#L254
And display the formatted value here https://github.com/Expensify/App/blob/937c4186409725b57fdaae6ae8e1d8c85a9d52a0/src/components/MoneyRequestConfirmationListFooter.tsx#L484-L487
As we do in MoneyRequestView, we should first convert the taxAmount to positive following the same method used in Money RequestVeiw
const taxAmount = TransactionUtils.getTaxAmount(transaction, false);
getTaxAmount() returns the absolute value of transaction.taxAmount
Then we format it
const formattedTaxAmount = CurrencyUtils.convertToDisplayString(taxAmount, iouCurrencyCode);
here
Note: Instead of passing false
as isExpenseReport
param to 'getTaxAmount', we can calculate isExpenseReport
using TransactionUtils.isExpenseReport(report))
.
The tax amount is negative when manually entering tax amount when splitting expense
If we create a split bill with entering the tax amount manually, BE returns the tax amount as negative amount for expense report.
And in here, we doesn't convert the tax mount to positive value before getting the formatted string. https://github.com/Expensify/App/blob/5cebd3ebb70e95a66ecdd60b3057027b619da39a/src/components/MoneyRequestConfirmationListFooter.tsx#L254
If we create a split bill with entering the tax amount manually, BE returns the tax amount as negative amount for expense report.
With this case BE returns the tax amount as negative amount for expense report. But if we don't enter the tax amount manually, BE returns it as positive amount. So here we should use getTaxAmountAbsValue
to make sure that the displayed tax amount is always positive value
const formattedTaxAmount = CurrencyUtils.convertToDisplayString(ModifiedExpenseMessage.getTaxAmountAbsValue(transaction?.taxAmount ?? 0), iouCurrencyCode);
We can fix from BE side to always return the tax amount of split bill transaction in expense report as negative amount
And then here, we can use getTaxAmount
function that had already covered the negative amount case for expense chat.
const formattedTaxAmount = CurrencyUtils.convertToDisplayString(TransactionUtils.getTaxAmount(transaction, isPolicyExpenseChat), iouCurrencyCode);
@CortneyOfstad Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
I was able to recreate so going to get eyes on this!
Job added to Upwork: https://www.upwork.com/jobs/~01f472383a767ded73
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External
)
Thanks for the proposals.
We can fix from BE side to always return the tax amount of split bill transaction in expense report as negative amount
@nkdengineer have you found any case where @etCoderDysto's solution is not working?
- const formattedTaxAmount = CurrencyUtils.convertToDisplayString(transaction?.taxAmount, iouCurrencyCode);
+ const formattedTaxAmount = CurrencyUtils.convertToDisplayString(TransactionUtils.getTaxAmount(transaction, false), iouCurrencyCode);
@aimane-chnaif I can't find.
@etCoderDysto's proposal looks good. They're the first to provide root cause and working solution. πππ C+ reviewed
Triggered auto assignment to @hayata-suenaga, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Hi @hayata-suenaga, should I go on with creating the PR?
sorry I have been sick for a while. yes! let's go with your proposal, @etCoderDysto! π
π£ @etCoderDysto You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing π
sorry I have been sick for a while. yes! let's go with your proposal, @etCoderDysto! π
Np π. I hope you are feeling better now.
PR will be ready for review in few hours.
@aimane-chnaif PR is ready for review.
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.7-8 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-07-24. :confetti_ball:
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
@aimane-chnaif β please complete the check ASAP so there is no further delay in payment. Thanks!
@etCoderDysto β I sent you an offer in Upwork, please let me know once you accept and I will get that paid ASAP. Thanks!
@CortneyOfstad I have accepted the offer. Thank you!
Offending PR with comment: https://github.com/Expensify/App/pull/32550#issuecomment-2248669786
We already have regression test as stated in OP
@etCoderDysto β paid $250 via Upwork @aimane-chnaif β to be paid $250 via NewDot
Thanks all!
@CortneyOfstad I am still using upwork. Can you please reopen and sort payment? Thanks
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0-3.2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4678911 Issue reported by: Applause - Internal Team
Action Performed:
Precondition:
Expected Result:
The tax amount will not be negative
Actual Result:
The tax amount is negative when manually entering tax amount when splitting expense
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/4551dcf0-6163-4320-93e0-874312a2ba63
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @CortneyOfstad