-
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
[HOLD for payment 2024-12-16] [HOLD for payment 2024-12-11] [$250] [Held requests] Partial paying a report causes the wrong amounts to show in the LHN #48760
Comments
Triggered auto assignment to @kevinksullivan ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Approving partly a report with held transaction will show the incorrect amount for the new report that contains all the held transaction. What is the root cause of that problem?There are 2 problems. First, when we approve the report, we create the new expense report optimistically that contains all the held transactions, but, we only use the first amount as the report total amount. Lines 6390 to 6394 in 03ec468
Also, we don't optimistically update the approved report total by subtracting the current total with the new expense report total Lines 6943 to 6949 in 03ec468
Second, even though the optimistic data is incorrect, we receive the correct data from the BE response. However, the LHN last message isn't updated immediately. The LHN shows the total from the expense report and we get the report inside the function instead of connecting the LHN component with the report. App/src/libs/OptionsListUtils.ts Lines 625 to 626 in 03ec468
And even though we connect all reports inside lhn list,
the OptionRowLHNData is memoized, so it won't re-render if the props are not changed. What changes do you think we should make in order to solve the problem?Update the optimistic data to set the correct amount for the new expense report. Line 6394 in 03ec468
We can calculate it from the report total and unheldTotal, or sum the amount from the individual transaction amount. Then, we need to update the current expense report total too. Lines 6918 to 6922 in 03ec468
Lines 6943 to 6949 in 03ec468
Solving the optimistic data is currently enough for the LHN to show the correct amount. But if we also want to fix the 2nd issue, then we can connect the expense report in
Then, pass it to App/src/libs/OptionsListUtils.ts Lines 625 to 626 in 03ec468
However, there is a BE issue, specifically the ApproveMoneyRequest API where the response returns the previous iouReportID instead of the new one. For example, let's say the current iouReportID is 1 which has 2 held transactions. After approving it, we optimistically move the 2 held transactions to a new report with an ID of 2 then update iouReportID to 2. But the ApproveMoneyRequest response revert the iouReportID back to 1. If we refresh/reopen the chat report, the OpenReport will return the correct iouReportID, 2. So, we need to fix the BE if we want to apply this solution. If we don't want to rely on iouReportID, then we can follow the same logic here by taking the last action and extract the App/src/libs/OptionsListUtils.ts Line 626 in 03ec468
Fortunately, we already get the
so we just need to retrieve the report and pass it down to OptionRowLHNData.
|
Job added to Upwork: https://www.upwork.com/jobs/~021833144594407206391 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
Adding Robert for the secondary internal review of the proposals for hold. @s77rt can you review the above from Bernhard? Thanks! |
Just a request that we make sure we test proposed solutions with both iouReports and expenseReports, because they are different report types. |
@bernhardoj Thanks for the proposal. Can you explain how this is related to optimistic data? Per the OP video, the incorrect data is on User A and not User B. (The optimistic data you referred to are for User B) Seems like a pusher related issue |
Oh, I didn't notice the OP video since it's different from the Actions performed. Can you test using the Actions performed instead of the OP video? |
@bernhardoj Ah I see, we have multiple similar bugs. The RCA and the solution for the bug you mentioned make sense to me. But let's not update the 🎀 👀 🎀 C+ reviewed |
Current assignee @robertjchen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
@robertjchen Please note that we have two bugs reported here. The bug reported in the "Action Performed" section is FE and @bernhardoj's solution above will fix it. However the bug showcased in the OP video is a little different and seems related to pusher events. After the payer approved some expenses, the payee got wrong new amount that the WS still owes (it should be non-zero since some expenses are still held) |
This one's moving forward. Looping in another BZ member as I'll be off till September 24 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.70-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-12-11. 🎊 For reference, here are some details about the assignees on this issue:
|
@s77rt @RachCHopkins @s77rt The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
Hey @bernhardoj have you already been paid here? I assume no, since there is no additional comment from the payer, but I just want to be 100% sure. |
Yes, I've been paid before, but then we realize there is a case we don't handle correctly. But I think it would be fair if the price is increased here since we tackle multiple other issues too on the 2nd PR. cc: @s77rt |
The first one isn't a regression. Before the PR, we just took 1 transaction amount from the expense, and then we calculated it all on the 1st PR, but we didn't handle the case when there was a different currency. The 2nd one as explained the root here, it was done as an attempt to fix other issues too. |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.72-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-12-16. 🎊 For reference, here are some details about the assignees on this issue:
|
@s77rt @RachCHopkins @s77rt The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button] |
@bernhardoj Right, the first one was already broken but the second is something that I expected to be handled in the PR. But I agree that the work turned out more complex than originally expected. @RachCHopkins Can you please bump this to $500? As for the checklist, it has been already provided in #48760 (comment) but now we need to add a regression test: Regression Test ProposalPrecondition:
Test:
|
@robertjchen do you agree that this is worth $500 due to the extra work involved? And @bernhardoj and @s77rt who has been paid what so far? As far as I'm aware, @bernhardoj has been paid $250 and @s77rt has not put any payment request in yet. Is that correct? |
Yes, I've been paid $250 before. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.30-15
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
Expensify/Expensify Issue URL:
Issue reported by: @JmillsExpensify
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1725649428907579
Action Performed:
Expected Result:
The report amount in the LHN is correct.
Actual Result:
The report amount in the LHN only shows the amount of one expense
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Recording.522.mp4
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @robertjchenThe text was updated successfully, but these errors were encountered: