-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$500] IOU - Incorrect total amount shown when deleting money request in offline mode #26054
Comments
Triggered auto assignment to @adelekennedy ( |
Bug0 Triage Checklist (Main S/O)
|
Job added to Upwork: https://www.upwork.com/jobs/~0140d719da85b979b3 |
Current assignee @adelekennedy is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav ( |
🐛 let's make it external |
ProposalPlease re-state the problem that we are trying to solve in this issue.Incorrect total amounts shown after editing invoices What is the root cause of that problem?Logic is missing in IOU due to which the total amount of What changes do you think we should make in order to solve the problem?Add the required code here to fill step 3 What alternative solutions did you explore? (Optional)-- Working Demo (Implemented already, waiting for assignment)Screen.Recording.2023-08-31.at.8.51.01.AM.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.IOU - Incorrect total amount shown when deleting money request in offline mode What is the root cause of that problem?When edit the money request we lack of re-calculating the amount, so after deleting the request, we use the outdated amount Line 980 in c20c387
What changes do you think we should make in order to solve the problem?We should add the logic to re-calculate the amount in
ResultScreen.Recording.2023-08-31.at.11.22.39.mp4 |
@im-adithya Can you please explain/share some details on how are you planning to get the total? Which objects/properties will you use to update? |
Hey @mananjadhav, I first added this utils function in IOUUtils.js function editIOUTotal(iouReport, initialTransaction, updatedTransaction, isExpenseReport = false) {
if (initialTransaction.currency !== updatedTransaction.currency) {
return iouReport;
}
const initialAmount = TransactionUtils.getAmount(initialTransaction, false);
const updatedAmount = TransactionUtils.getAmount(updatedTransaction, false);
// Make a copy so we don't mutate the original object
const iouReportUpdate = {...iouReport};
iouReportUpdate.total += !isExpenseReport ? -initialAmount : initialAmount;
iouReportUpdate.total += !isExpenseReport ? updatedAmount : -updatedAmount;
iouReportUpdate.hasOutstandingIOU = iouReportUpdate.total !== 0;
return iouReportUpdate;
} And then used this to fill step 3 mentioned above to update the IOUReport and then also updated the message "xxx owes $yyy " using the And finally update the optimistic, success and failure data which are used while making the API call. That fixed the issue (both while request amounts from others (+) and while requesting in own workspace (-)) as in the demo. Let me know if there are any changes, happy to tweak the solution as per the requirement! |
Also, this error also persists in online mode too, not just offline! Would like to request if the bounty can be raised as this is more critical than tooltips issue (an example) 🙏 |
Thanks for the details @im-adithya. Few more clarifications. Why do we need to Also what does
I think it is a fair price, but I will still leave this for the internal team to decide. |
@mananjadhav What do you think about my proposal? Thanks |
Yes we can do both, I had the initialTransaction and updatedTransaction readily available in the above lines from Step 1 and 2 respectively so I thought of using them to keep it uniform like it's used here: Line 1114 in 12a6f87
Just to give more context on how the utils function is going to be used: const updatedIOUReport = IOUUtils.editIOUTotal(iouReport, transaction, updatedTransaction, isFromExpenseReport); Initial Tx: Line 973 in 12a6f87
updated Tx: Line 979 in 12a6f87
and then we move forward to edit the message: const reportPreviewAction = ReportActionsUtils.getReportPreviewAction(iouReport.chatReportID, iouReport.reportID);
const updatedReportPreviewAction = {...reportPreviewAction};
const messageText = Localize.translateLocal('iou.payerOwesAmount', {
payer: updatedIOUReport.managerEmail,
amount: CurrencyUtils.convertToDisplayString(updatedIOUReport.total, updatedIOUReport.currency),
});
updatedReportPreviewAction.message[0].text = messageText;
updatedReportPreviewAction.message[0].html = messageText; and then finally add |
That definitely is a fair price individually, just wanted to bring up the comparison based on issue criticality/difficulty. |
@im-adithya's proposal looks good to me. 🎀 👀 🎀 C+ reviewed. |
Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
And @adelekennedy @yuwenmemon your thoughts on this comment. |
Current assignee @mananjadhav is eligible for the External assigner, not assigning anyone new. |
Yep, sorry for the delay I was out for a US holiday! (also sorry for the label spam I clicked the wrong button 🤦 ) |
@mananjadhav not opening a new PR as there's #26486 already |
@yuwenmemon @adelekennedy The fix was merged with another PR, while I was OOO and this one got delayed. IMO, @im-adithya is eligible for the full compensation on this one. |
Sounds good, thanks for letting us know @mananjadhav - I guess we'll just close this out then @adelekennedy? |
@adelekennedy @mananjadhav Hey guys even though this was fixed by another PR, as it was a legitimate bug shouldnt i be eligible for reporter bonus? |
@adelekennedy did you get to see my comment regarding compensation for @im-adithya? |
Yes! Payouts due:Issue Reporter: $250 @SofoniasN (as this was a legit bug) Upwork Eligible for 50% #urgency bonus? N Upwork job is here. |
Thanks @adelekennedy. |
@SofoniasN @im-adithya will you apply here |
Thanks @adelekennedy, however it says |
Hey @adelekennedy since the upwork job link is private, i couldnt apply. |
$500 payment approved for @mananjadhav based on BZ summary. |
@SofoniasN @im-adithya I swear this is this Upwork bug when we re-use postings, try this link? |
Now it says |
I have refreshed it again - edited it and republished. If this doesn't work I will open a new job:https://www.upwork.com/jobs/~0140d719da85b979b3 |
Then this is an Upwork bug as I see it's public on my end 💀 I'm going to close this one and open a new one |
🤞 @SofoniasN @im-adithya - I closed the original and created a new job |
Done now! Thanks again @adelekennedy! |
@adelekennedy works now. Offer accepted! |
hired! |
@adelekennedy offer accepted. Thank you! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
0 should be shown in total amount
Actual Result:
A difference of the initial amount and edited amount is shown as total
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.57-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
2023_08_27_10_25_34.mp4
Record_2023-08-27-23-54-30.mp4
Expensify/Expensify Issue URL:
Issue reported by: @SofoniasN
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692445455325269
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: