You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-03-06] [$500] Copy to clipboard on the system message for paid expense copies negative amount #35375
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
changed the title [-]Copy to clipboard on the system message for paid expense copies negative amount[/-][+][$500] Copy to clipboard on the system message for paid expense copies negative amount[/+]on Jan 30, 2024
Please re-state the problem that we are trying to solve in this issue.
Copied "paid" report action contains a negative amount
What is the root cause of that problem?
Since the Paid action means the user pays money, not receives it, the IOU amount is set with a negative value in the originalMessage.IOUDetails. We do not negate this value when copying the message to clipboard:
What changes do you think we should make in order to solve the problem?
When building an optimistic Paid report action, we should set the same amount value as it comes from the BE.
We should use iouReport.total, not -iouReport.total:
Please re-state the problem that we are trying to solve in this issue.
Copy to clipboard on the system message for paid expense copies negative amount
What is the root cause of that problem?
In here, when generating optimistic data for the pay money request, we're always negating the amount (-iouReport.total)
This is wrong because the amount will only be stored as negative for the Workspace expense report, for other IOUs, it will be positive, more context here (and a lot of other places).
If we go online, this problem no longer happens because the data from back-end is correct (positive)
So the root cause is the optimistic data of the amount in normal IOU case is wrong.
What changes do you think we should make in order to solve the problem?
In here, only negate the total amount if the iouReport is a workspace expense.
Simply changing to iouReport.total will reintroduce the same problem for expense report that was fixed here (it used to be iouReport.total without sign before that PR), because iouReport.total is negative for expense report.
What alternative solutions did you explore? (Optional)
changed the title [-][$500] Copy to clipboard on the system message for paid expense copies negative amount[/-][+][HOLD for payment 2024-03-06] [$500] Copy to clipboard on the system message for paid expense copies negative amount[/+]on Mar 1, 2024
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
Activity
[-]Copy to clipboard on the system message for paid expense copies negative amount[/-][+][$500] Copy to clipboard on the system message for paid expense copies negative amount[/+]melvin-bot commentedon Jan 30, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0170b576c255476ae4
melvin-bot commentedon Jan 30, 2024
Triggered auto assignment to @twisterdotcom (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 30, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)paultsimura commentedon Jan 30, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copied "paid" report action contains a negative amount
What is the root cause of that problem?
Since the Paid action means the user pays money, not receives it, the IOU amount is set with a negative value in the
originalMessage.IOUDetails. We do not negate this value when copying the message to clipboard:App/src/libs/ReportUtils.ts
Lines 4377 to 4398 in 480ae8d
What changes do you think we should make in order to solve the problem?
When building an optimistic Paid report action, we should set the same
amountvalue as it comes from the BE.We should use
iouReport.total, not-iouReport.total:App/src/libs/actions/IOU.js
Lines 3089 to 3099 in 6198343
What alternative solutions did you explore? (Optional)
When building the getIOUReportActionDisplayMessage, use
Math.abs(amount)instead ofamount:tienifr commentedon Jan 30, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Copy to clipboard on the system message for paid expense copies negative amount
What is the root cause of that problem?
In here, when generating optimistic data for the pay money request, we're always negating the amount (
-iouReport.total)This is wrong because the amount will only be stored as negative for the Workspace expense report, for other IOUs, it will be positive, more context here (and a lot of other places).
If we go online, this problem no longer happens because the data from back-end is correct (positive)
So the root cause is the optimistic data of the amount in normal IOU case is wrong.
What changes do you think we should make in order to solve the problem?
In here, only negate the total amount if the
iouReportis a workspace expense.Simply changing to
iouReport.totalwill reintroduce the same problem for expense report that was fixed here (it used to beiouReport.totalwithout sign before that PR), becauseiouReport.totalis negative for expense report.What alternative solutions did you explore? (Optional)
Using
Math.abs(here is also ok.parasharrajat commentedon Jan 30, 2024
@tienifr proposal's main solution makes sense. Good point on catching the Expense Report case.
🎀 👀 🎀 C+ reviewed
melvin-bot commentedon Jan 30, 2024
Triggered auto assignment to @grgia, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
12 remaining items
parasharrajat commentedon Feb 20, 2024
PR reviewed.
parasharrajat commentedon Feb 29, 2024
PR deployed to PROD.
tienifr commentedon Mar 1, 2024
@twisterdotcom PR hit production. Melvin is malfunctioning. Please add HOLD for payment label.
[-][$500] Copy to clipboard on the system message for paid expense copies negative amount[/-][+][HOLD for payment 2024-03-06] [$500] Copy to clipboard on the system message for paid expense copies negative amount[/+]twisterdotcom commentedon Mar 1, 2024
Eugh, no Melvin comments either. 😭 Why do you make me do work Melvin.
melvin-bot commentedon Mar 14, 2024
@twisterdotcom, @parasharrajat, @grgia, @tienifr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
twisterdotcom commentedon Mar 15, 2024
Wow, I need to pay this. Sorry for the tardiness.
twisterdotcom commentedon Mar 15, 2024
Payment Summary:
parasharrajat commentedon May 20, 2024
Payment requested as per #35375 (comment)
JmillsExpensify commentedon May 31, 2024
$500 approved for @parasharrajat