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

[Awaiting Checklist Completion] [$500] Unable to create a Distance request from an Expense Report #30407

Closed
6 tasks done
kavimuru opened this issue Oct 26, 2023 · 37 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff

Comments

@kavimuru
Copy link

kavimuru commented Oct 26, 2023

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.3.91-1
Reproducible in staging?: y
Reproducible in production?: y
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: @paultsimura
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1698185015146149

Action Performed:

  1. Create a chat
  2. Click the '+' button > Request money
  3. Notice the Distance option is available

VS

  1. Create a chat
  2. Click the '+' button > Request money > add an Amount
  3. Send the request to someone
  4. Click on an IOU
  5. Then click on the '+' of the IOU chat > Request Money
  6. Notice the distance is missing

Expected Result:

The "Distance" tab should be present

Actual Result:

The "Distance" tab is absent, only "Manual" and "Scan" are present.

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

Android: Native
Screen.Recording.2023-10-25.at.07.51.59.mov
Android: mWeb Chrome
Screen.Recording.2023-10-25.at.07.51.59.mov
iOS: Native
RPReplay_Final1698212930.MP4
iOS: mWeb Safari
RPReplay_Final1698211822.MP4
MacOS: Chrome / Safari
Screen.Recording.2023-10-25.at.07.28.30.mov
Recording.1640.mp4
MacOS: Desktop
Screen.Recording.2023-10-25.at.09.01.18.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018ee1716b83450d28
  • Upwork Job ID: 1717367371596656640
  • Last Price Increase: 2023-11-02
  • Automatic offers:
    • paultsimura | Contributor | 27511292
    • paultsimura | Reporter | 27511294
@kavimuru kavimuru added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@melvin-bot melvin-bot bot changed the title Unable to create a Distance request from an Expense Report [$500] Unable to create a Distance request from an Expense Report Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 26, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@kavimuru
Copy link
Author

Proposal from @paultsimura

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

The Distance request cannot be created from an expense report

What is the root cause of that problem?

We have a clear check whether to show the distance tab here:

const isFromGlobalCreate = !reportID;
const isExpenseRequest = ReportUtils.isPolicyExpenseChat(props.report);
const shouldDisplayDistanceRequest = isExpenseRequest || isFromGlobalCreate;

It's currently configured to show only on FAB and Expense Chats.

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

First, We should modify the code above to show the distance tab on the expense reports as well:

    const isFromGlobalCreate = !reportID;
    const isExpenseChat = ReportUtils.isPolicyExpenseChat(props.report)
    const isExpenseReport = ReportUtils.isExpenseReport(props.report);
    const shouldDisplayDistanceRequest = isExpenseChat || isExpenseReport || isFromGlobalCreate;

Second, we should adapt the flow for creation of such requests on the expense reports. For this, in IOU.createDistanceRequest, check if the report is an expense report: if it is, we should use its root parent report (it'll be an expense chat) for all the calculations, but use this expense report's ID for final redirection, so we are not redirected to parent chat on creation:

function createDistanceRequest(report, participant, comment, created, transactionID, category, tag, amount, currency, merchant, billable) {
+    const isExpenseReport = ReportUtils.isExpenseReport(report);
+    const targetChat = isExpenseReport ? ReportUtils.getRootParentReport(report) : report;
    const optimisticReceipt = {
        source: ReceiptGeneric,
        state: CONST.IOU.RECEIPT_STATE.OPEN,
    };
    const {iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation(
+        targetChat,
-        report,
        participant,

Also, use this report here, because in some cases we allow creating money requests in already settled expense reports proof: https://github.com/Expensify/App/blob/950f37a31154aef422fadc194c3791cd84354675/src/libs/ReportUtils.js#L3565C4-L3577), and the getMoneyRequestInformation, which we use to retrieve iouReport.reportID, always returns the non-settled report:

iouReportID: isExpenseReport ? report.reportID : iouReport.reportID,

iouReportID: iouReport.reportID,

And here for the final navigation so we get redirected directly to the expense report:

    Navigation.dismissModal(isExpenseReport ? report.reportID : chatReport.reportID);

Navigation.dismissModal(chatReport.reportID);

Result:

Screen.Recording.2023-10-25.at.09.12.19.mp4

What alternative solutions did you explore? (Optional)

@paultsimura
Copy link
Contributor

paultsimura commented Oct 26, 2023

Proposal

Please disregard the proposal above: I reposted it here as I wanted to modify the original proposal.

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

The Distance request cannot be created from an expense report

What is the root cause of that problem?

We have a clear check whether to show the distance tab here:

const isFromGlobalCreate = !reportID;
const isExpenseRequest = ReportUtils.isPolicyExpenseChat(props.report);
const shouldDisplayDistanceRequest = isExpenseRequest || isFromGlobalCreate;

It's currently configured to show only on FAB and Expense Chats.

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

First, We should modify the code above to show the distance tab on the expense reports as well (the Distance requests are currently limited to workspaces only, so we should use the expense reports, not IOU reports):

    const isFromGlobalCreate = !reportID;
    const isExpenseChat = ReportUtils.isPolicyExpenseChat(props.report)
    const isExpenseReport = ReportUtils.isExpenseReport(props.report);
    const shouldDisplayDistanceRequest = isExpenseChat || isExpenseReport || isFromGlobalCreate;

Second, we should adapt the flow for the creation of such requests on the expense reports. For this, in IOU.createDistanceRequest we should mimic the logic of IOU.requestMoney: check if the report is a money request report: if it is, we should use its chat report for all the calculations in getMoneyRequestInformation:

function createDistanceRequest(report, participant, comment, created, transactionID, category, tag, amount, currency, merchant, billable) {
+ // If the report is iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function
+   const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report);
+   const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report.chatReportID) : report;
    const optimisticReceipt = {
        source: ReceiptGeneric,
        state: CONST.IOU.RECEIPT_STATE.OPEN,
    };
    const {iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation(
+        currentChatReport,
-        report,
        participant,

Third, use this expense report here for the final navigation so we get redirected directly to it instead of the chat report:

    Navigation.dismissModal(isMoneyRequestReport ? report.reportID : chatReport.reportID);

Navigation.dismissModal(chatReport.reportID);

Result:

Screen.Recording.2023-10-25.at.09.12.19.mp4

What alternative solutions did you explore? (Optional)

@Christinadobrzyn
Copy link
Contributor

I think based on our change announced here - https://expensify.slack.com/archives/C01GTK53T8Q/p1698191269281379

We can close this since it was reported by a contributor.

@paultsimura
Copy link
Contributor

paultsimura commented Oct 26, 2023

@Christinadobrzyn this was reported before the announcement.
And in the announcement, it's clearly stated:

Please note that any bugs reported prior to this announcement will be accepted and treated as they normally would.

Why would you close it then?

It also was discussed in Slack with the engineers and the reporting was approved before the announcement: https://expensify.slack.com/archives/C01GTK53T8Q/p1698182060752669

@greg-schroeder
Copy link
Contributor

@Christinadobrzyn we can take bug reports that were sent to #expensify-bugs prior to the announcement

@Christinadobrzyn
Copy link
Contributor

Ah thanks, I didn't realise it was the Slack date not the GH creation date. Sorry about that! This is a good find so I'm glad we're doing it.

I can reproduce and I don't see any other GHs about this issue.

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@Christinadobrzyn
Copy link
Contributor

@thesahindia can you review the provided proposals to see if they will work? Thanks!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 30, 2023
Copy link

melvin-bot bot commented Nov 2, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@Christinadobrzyn
Copy link
Contributor

@thesahindia could you review these proposals and let me know if you want to see others?

@melvin-bot melvin-bot bot removed the Overdue label Nov 2, 2023
@thesahindia
Copy link
Member

thesahindia commented Nov 3, 2023

@paultsimura's proposal looks good to me!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 3, 2023

Triggered auto assignment to @flodnv, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@flodnv
Copy link
Contributor

flodnv commented Nov 3, 2023

Hmmm @neil-marcellini what are your thoughts on this please?

Copy link

melvin-bot bot commented Nov 10, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 10, 2023
Copy link

melvin-bot bot commented Nov 10, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.97-7 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 2023-11-17. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 10, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@thesahindia] The PR that introduced the bug has been identified. Link to the PR:
  • [@thesahindia] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@thesahindia] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@thesahindia] Determine if we should create a regression test for this bug.
  • [@thesahindia] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@Christinadobrzyn Christinadobrzyn changed the title [HOLD for payment 2023-11-17] [$500] Unable to create a Distance request from an Expense Report [HOLD for payment 2023-11-21] [$500] Unable to create a Distance request from an Expense Report Nov 18, 2023
@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Nov 18, 2023

Looks like the PR went to production 3 days ago so payment would be Nov 21st.

I'm going ooo until Monday Nov 27th so going to assign another BZ teammate to monitor this until I'm back. Thanks!

Status: waiting for payment & regression test proposal

Payouts due:

Issue Reporter: $50 @paultsimura - reporter bonus (in Upwork)
Contributor: $500 @paultsimura (in Upwork)
Contributor+: $500 @thesahindia (through NewDot)

Eligible for 50% #urgency bonus? N

Upwork job is here.

@Christinadobrzyn Christinadobrzyn removed the Bug Something is broken. Auto assigns a BugZero manager. label Nov 18, 2023
@Christinadobrzyn Christinadobrzyn removed their assignment Nov 18, 2023
@Christinadobrzyn Christinadobrzyn added the Bug Something is broken. Auto assigns a BugZero manager. label Nov 18, 2023
Copy link

melvin-bot bot commented Nov 18, 2023

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 18, 2023

This comment was marked as off-topic.

@Christinadobrzyn Christinadobrzyn self-assigned this Nov 18, 2023
@melvin-bot melvin-bot bot added the Overdue label Nov 20, 2023
@twisterdotcom
Copy link
Contributor

Payment due tomorrow.

@melvin-bot melvin-bot bot removed the Overdue label Nov 20, 2023
@twisterdotcom
Copy link
Contributor

Payment Summary:
@paultsimura paid $550 via Upwork (https://www.upwork.com/nx/wm/workroom/35345726/overview / https://www.upwork.com/nx/wm/workroom/35345722/overview
@thesahindia $500 (through NewDot)

Waiting on @thesahindia to complete the checklist now.

@twisterdotcom twisterdotcom removed the Awaiting Payment Auto-added when associated PR is deployed to production label Nov 21, 2023
@twisterdotcom twisterdotcom changed the title [HOLD for payment 2023-11-21] [$500] Unable to create a Distance request from an Expense Report [Awaiting Checklist Completion] [$500] Unable to create a Distance request from an Expense Report Nov 21, 2023
Copy link

melvin-bot bot commented Nov 23, 2023

@twisterdotcom @paultsimura @neil-marcellini @Christinadobrzyn @thesahindia this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is today
  • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor labels Nov 23, 2023
Copy link

melvin-bot bot commented Nov 23, 2023

Current assignee @thesahindia is eligible for the Internal assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added the Overdue label Nov 24, 2023
@thesahindia
Copy link
Member

I believe we just weren't handling this case.

We can add a test case -

  1. Request money from a workspace
  2. Click on the newly created money request in the chat
  3. Click "+" > Request money
  4. Verify you see the distance tab

@JmillsExpensify
Copy link

$500 payment approved for @thesahindia based on this comment.

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. Daily KSv2 Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

9 participants