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

[$250] IOU - GBR is missing from the partially approved expense #52650

Open
2 of 8 tasks
lanitochka17 opened this issue Nov 15, 2024 · 41 comments
Open
2 of 8 tasks

[$250] IOU - GBR is missing from the partially approved expense #52650

lanitochka17 opened this issue Nov 15, 2024 · 41 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 15, 2024

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.63-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5229984&group_by=cases:section_id&group_id=309128&group_order=asc
Issue reported by: Applause - Internal Team

Action Performed:

  • All new Gmail accounts are used
  • Workspace has an admin, member, and approver
  • "Add approvals" is enabled and the approver account is set as the approver
  1. Member: Navigate to https://staging.new.expensify.com/
  2. Member: Log in
  3. Member: Navigate to the workspace chat
  4. Member: Create two manual expenses with any amounts (amounts should be different)
  5. Member: Open one of the expenses
  6. Member: Put the expense on hold
  7. Approver: Log in
  8. Approver: Navigate to the workspace chat
  9. Approver: Click on "Approve"
  10. Approver: Approve just the pending amount

Expected Result:

Newly created report for the held expense is GBR’ed in the LHN (green dot)

Actual Result:

GBR is missing from the partially approved expense

Workaround:

Unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6666642_1731695994415.bandicam_2024-11-15_19-27-51-840.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021861120032414784544
  • Upwork Job ID: 1861120032414784544
  • Last Price Increase: 2024-11-25
  • Automatic offers:
    • DylanDylann | Reviewer | 105123872
    • nkdengineer | Contributor | 105123876
Issue OwnerCurrent Issue Owner: @DylanDylann
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 15, 2024
Copy link

melvin-bot bot commented Nov 15, 2024

Triggered auto assignment to @OfstadC (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.

@melvin-bot melvin-bot bot added the Overdue label Nov 18, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Nov 18, 2024

Not overdue Mel - it was the weekend. Will review this tomorrow AM

@melvin-bot melvin-bot bot removed the Overdue label Nov 18, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Nov 19, 2024

@lanitochka17

GBR should be visible

What specifically is missing here

@OfstadC
Copy link
Contributor

OfstadC commented Nov 19, 2024

It seems normal to me 🤔

@OfstadC
Copy link
Contributor

OfstadC commented Nov 21, 2024

@kavimuru
Copy link

Still reproducible. Actions performed are same, updated the expected result

bandicam.2024-11-22.12-34-26-431.mp4

@OfstadC
Copy link
Contributor

OfstadC commented Nov 22, 2024

OMG - It was not clear what GBR was to me - April was a saint and helped me!

@OfstadC
Copy link
Contributor

OfstadC commented Nov 22, 2024

I actually think this is a dupe of this

@melvin-bot melvin-bot bot added the Overdue label Nov 25, 2024
@OfstadC
Copy link
Contributor

OfstadC commented Nov 25, 2024

Re-reviewing the other issue it seems they are closely related but differ a bit. Adding to #expense

@melvin-bot melvin-bot bot removed the Overdue label Nov 25, 2024
@OfstadC OfstadC added the External Added to denote the issue can be worked on by a contributor label Nov 25, 2024
@melvin-bot melvin-bot bot changed the title IOU - GBR is missing from the partially approved expense [$250] IOU - GBR is missing from the partially approved expense Nov 25, 2024
Copy link

melvin-bot bot commented Nov 25, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 25, 2024
Copy link

melvin-bot bot commented Nov 25, 2024

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

@nkdengineer
Copy link
Contributor

nkdengineer commented Nov 25, 2024

Edited by proposal-police: This proposal was edited at 2024-11-26 05:05:16 UTC.

Proposal

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

GBR is missing from the partially approved expense

What is the root cause of that problem?

If we approve partially, a new expense report will be created with statusNum and stateNum are getting from here

const optimisticExpenseReport = isPolicyExpenseChat

If isInstantSubmitEnabled and payment is not disabled, the new expense report is marked as submitted.

App/src/libs/ReportUtils.ts

Lines 4646 to 4649 in 38568ed

if (isInstantSubmitEnabled) {
return {
stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,
statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,

But in this case hasOutstandingChildRequest is updated to false here before we get the onyx data of the partially case

hasOutstandingChildRequest: hasIOUToApproveOrPay(chatReport, expenseReport?.reportID ?? '-1'),

So no GBR is displayed in LHN

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

If we approve in full, we can update hasOutstandingChildRequest like this

hasOutstandingChildRequest: hasIOUToApproveOrPay(chatReport, expenseReport?.reportID ?? '-1'),

In this case, it is not full, we need to update hasOutstandingChildRequest of the chat report to true if the new expense report is marked as submitted

if (!full && !!chatReport && !!expenseReport) {

  1. We need to move this optimistic data to this case
if (full && hasHeldExpenses) {
      optimisticData.push({
          onyxMethod: Onyx.METHOD.MERGE,
          key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport?.chatReportID}`,
          value: {
              hasOutstandingChildRequest: hasIOUToApproveOrPay(chatReport, expenseReport?.reportID ?? '-1'),
          },
      });

const optimisticChatReportData: OnyxUpdate = {

  1. In getReportFromHoldRequestsOnyxData function, update hasOutstandingChildRequest of chat report to true if the new expense report is marked as submitted
hasOutstandingChildRequest: optimisticExpenseReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && optimisticExpenseReport.statusNum === CONST.REPORT.STATE_NUM.SUBMITTED,

value: {

  1. Require backend change: Backend also needs to update hasOutstandingChildRequest to true in this case of ApproveMoneyRequest API

What alternative solutions did you explore? (Optional)

@DylanDylann
Copy link
Contributor

@nkdengineer Do we need to require BE change to fix this issue?

@DylanDylann
Copy link
Contributor

It seems the BE return wrong hasOutstandingChildRequest in this case

@nkdengineer
Copy link
Contributor

@DylanDylann you're right, updated proposal.

@DylanDylann
Copy link
Contributor

There are some new updates that block partially approve flow. Just ask to clarify #50479 (comment)

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Nov 26, 2024
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 29, 2024
Copy link

melvin-bot bot commented Nov 29, 2024

📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Nov 29, 2024

📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@nkdengineer
Copy link
Contributor

nkdengineer commented Dec 2, 2024

In this case, it is not full, we need to update hasOutstandingChildRequest of the chat report to true if the new expense report is marked as submitted

@NikkiWines We have a draft PR here. Base on this description, can you please handle the backend change in ApproveMoneyRequest?

@NikkiWines
Copy link
Contributor

Yep, I'll start working on that asap

Copy link

melvin-bot bot commented Dec 3, 2024

@OfstadC, @NikkiWines, @DylanDylann, @nkdengineer Whoops! This issue is 2 days overdue. Let's get this updated quick!

@NikkiWines
Copy link
Contributor

Sorry for the delay here, I actually want to just run this by @marcochavezf to confirm intended functionality here.

@marcochavezf I see you in the blame here where we set hasOutstandingChildRequest to false to clear the GBR parent report - how do you feel about updating that to do so only if isFullApproval is true so that in the case of a partial approval the parent report has the GBR added?

@DylanDylann
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot removed the Overdue label Dec 5, 2024
@marcochavezf
Copy link
Contributor

how do you feel about updating that to do so only if isFullApproval is true so that in the case of a partial approval the parent report has the GBR added?

Oh sound good, the hasOutstandingChildRequest set to false was implemented before we had partial approvements, so yeah it makes sense to check if is full approval is true for this case

@NikkiWines
Copy link
Contributor

Backend PR is up

@NikkiWines
Copy link
Contributor

Backend PR is merged, will update here when it's deployed

Copy link

melvin-bot bot commented Dec 10, 2024

@OfstadC, @NikkiWines, @DylanDylann, @nkdengineer Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Dec 10, 2024
@DylanDylann
Copy link
Contributor

waiting for BE deployment

@melvin-bot melvin-bot bot removed the Overdue label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 13, 2024

@OfstadC @NikkiWines @DylanDylann @nkdengineer this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@DylanDylann
Copy link
Contributor

@nkdengineer It seems we are ready to implement the PR

@nkdengineer
Copy link
Contributor

thanks @DylanDylann, I'll check and open PR soon

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 18, 2024
@nkdengineer
Copy link
Contributor

@DylanDylann we have a open PR here

@DylanDylann
Copy link
Contributor

@NikkiWines In this issue, ApproveMoneyRequest API return chatReport.hasOutstandingChildRequest is true in A, but the openReport API return chatReport.hasOutstandingChildRequest is false --> the bug isn't fixed if we click on report again

@NikkiWines
Copy link
Contributor

but the openReport API return chatReport.hasOutstandingChildRequest is false --> the bug isn't fixed if we click on report again

@DylanDylann sorry, can you clarify what steps you take to reproduce this?

(also sorry for not updating when that BE PR went live 🙈)

@DylanDylann
Copy link
Contributor

DylanDylann commented Dec 23, 2024

Steps:

  1. Member: Log in
  2. Member: Navigate to the workspace chat
  3. Member: Create two manual expenses with any amounts (amounts should be different)
  4. Member: Open one of the expenses
  5. Member: Put the expense on hold
  6. Approver: Log in
  7. Approver: Navigate to the workspace chat
  8. Approver: Click on "Approve"
  9. Approver: Approve just the pending amount
  10. See that:
  • ApproveMoneyRequest return hasOutstandingChildRequest is true in the chat report

  • Then if we click on another report and open the chat report again, OpenReport API returns hasOutstandingChildRequest as false in the chat report

Screen.Recording.2024-12-23.at.17.16.48.mov

@DylanDylann
Copy link
Contributor

@NikkiWines Kindly bump

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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

7 participants