Skip to content
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 on #378314][$500] [Held requests] Request on hold becomes unheld when approving only unheld request #39338

Closed
6 tasks done
lanitochka17 opened this issue Mar 31, 2024 · 33 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 31, 2024

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: 1.4.58-4
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #33124

Action Performed:

Precondition:

  • Admin and employee are in the Collect workspace
  1. [Employee] Request money from the workspace chat
  2. [Employee] Create two money requests
  3. [Employee] Hold one of the requests and leave the other one unheld
  4. [Admin] Go to expense report
  5. [Admin] Click Approve button
  6. [Admin] Approve the unheld request

Expected Result:

The request on hold will be moved to a new report

Actual Result:

Request on hold becomes unheld when approving only unheld request

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6433343_1711893426393.20240331_215154.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d6a3e193d64c10a4
  • Upwork Job ID: 1775018433509507072
  • Last Price Increase: 2024-04-09
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Mar 31, 2024
Copy link

melvin-bot bot commented Mar 31, 2024

Triggered auto assignment to @NikkiWines (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@lanitochka17
Copy link
Author

@NikkiWines 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

@NikkiWines
Copy link
Contributor

NikkiWines commented Apr 2, 2024

This definitely looks like a regression / unhandled case from #33124. I've been trying to reproduce locally but the behavior is pretty buggy on main right now (crashing when holding an expense, approving the full total and not the held amount, paying doesn't work because the "The requested amount has changed") so it's hard to see what's causing this particular staging behavior

Pinged @robertjchen since he's got context on the original PR and might be able to lend some insight here

@NikkiWines
Copy link
Contributor

NikkiWines commented Apr 2, 2024

Looks like - at least on dev - when approving the report, it's the optimisticIOUReportData from here that is overwriting the amount with the full (held + non-held) amount, even though the amount is correctly being set in optimisticApprovedReportAction here.

@robertjchen robertjchen added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Apr 2, 2024
@robertjchen
Copy link
Contributor

Thanks for the report! Definitely related to the changes there: #33124 and we'll be addressing it. Not a deploy blocker per the sentiments here

@NikkiWines
Copy link
Contributor

Sounds good, marking this as an external bug then so it can get worked on 👍

@NikkiWines NikkiWines added External Added to denote the issue can be worked on by a contributor Bug Something is broken. Auto assigns a BugZero manager. labels Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01d6a3e193d64c10a4

@melvin-bot melvin-bot bot changed the title Hold request - Request on hold becomes unheld when approving only unheld request [$500] Hold request - Request on hold becomes unheld when approving only unheld request Apr 2, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 2, 2024
Copy link

melvin-bot bot commented Apr 2, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (External)

Copy link

melvin-bot bot commented Apr 2, 2024

Triggered auto assignment to @trjExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@nkdengineer
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Request on hold becomes unheld when approving only unheld request

What is the root cause of that problem?

When we approve only unheld request, we don't create new expense report and report preview for the hold request. And BE also doesn't implement this like the expected here

The request on hold will be moved to a new report

function approveMoneyRequest(expenseReport: OnyxTypes.Report | EmptyObject, full?: boolean) {

What changes do you think we should make in order to solve the problem?

Add a new variable like shouldCreateNewPreview and update it to true in this case.

App/src/libs/actions/IOU.ts

Lines 4626 to 4627 in a4d01a8

if (ReportUtils.hasHeldExpenses(expenseReport.reportID) && !full && !!expenseReport.unheldTotal) {
total = expenseReport.unheldTotal;

If it's true, we will move all hold request to new report. The main steps:

  1. Create an optimistic expense report
  2. Move all IOU actions hold transactions from old expense report to new expense report
  3. Update the total of new expense report as the expenseReport.total - expenseReport.unheldTotal
  4. Update the total of the old expense report as expenseReport.unheldTotal
  5. Create an optimistic report preview for new expense report, the child request count is the number of hold requests, other fields can be updated accordingly base on hold requests
  6. Update the old report preview base on upheld requests

And we also need to implement this in back-end as well.

What alternative solutions did you explore? (Optional)

NA

Copy link

melvin-bot bot commented Apr 5, 2024

@trjExpensify, @NikkiWines, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Apr 5, 2024
@NikkiWines
Copy link
Contributor

@alitoshmatov please review the proposals when you have a moment 🙇

@robertjchen robertjchen changed the title [HOLD on 378314] [$500] [Held requests] Request on hold becomes unheld when approving only unheld request [HOLD on #378314][$500] [Held requests] Request on hold becomes unheld when approving only unheld request Apr 9, 2024
@trjExpensify
Copy link
Contributor

Hm, interesting! But @marcochavezf only has the currency issue remaining, no? I guess I don't know where this is being fixed, or if his earlier PRs shoul dhave.

@melvin-bot melvin-bot bot added the Overdue label Apr 11, 2024
Copy link

melvin-bot bot commented Apr 12, 2024

@trjExpensify, @NikkiWines, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@trjExpensify
Copy link
Contributor

Same, Melv!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 12, 2024
Copy link

melvin-bot bot commented Apr 15, 2024

@trjExpensify, @NikkiWines, @alitoshmatov Whoops! This issue is 2 days overdue. Let's get this updated quick!

@trjExpensify
Copy link
Contributor

@marcochavezf can you confirm if this issue is resolved with the PRs that have come for #378314?

@melvin-bot melvin-bot bot removed the Overdue label Apr 16, 2024
@marcochavezf
Copy link
Contributor

Yup, this issue was fixed in this PR

@trjExpensify
Copy link
Contributor

Cool, once deployed we close this out then. :)

@melvin-bot melvin-bot bot added the Overdue label Apr 18, 2024
Copy link

melvin-bot bot commented Apr 19, 2024

@trjExpensify, @NikkiWines, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@NikkiWines
Copy link
Contributor

Not overdue; waiting on #40065, which is currently on staging.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 22, 2024
@trjExpensify
Copy link
Contributor

Hit prod two days ago, closing!

@nkdengineer
Copy link
Contributor

@NikkiWines @trjExpensify We have this bug #41652 here this is the part of this issue since we don't implement the optimistic data when we approve partial. Can you please take a look and re-open this issue.

@NikkiWines
Copy link
Contributor

@NikkiWines @trjExpensify We have this bug #41652 here this is the part of this issue since we don't implement the optimistic data when we approve partial. Can you please take a look and re-open this issue.

Been focused on some other urgent issues but I will look into this during the week. From a quick glance it looks like there's some activity in the linked issue for resolving the issue as well. Re-opening for now so it doesn't fall off my radar.

@NikkiWines NikkiWines reopened this May 8, 2024
@NikkiWines NikkiWines added Weekly KSv2 and removed Daily KSv2 labels May 8, 2024
@trjExpensify
Copy link
Contributor

I think we can use the other issue for this follow-up. @nkdengineer I've assigned you for the C+ review on that.

@NikkiWines
Copy link
Contributor

Sounds good, re-closing this then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants