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 for payment 2023-10-10] [HOLD for payment 2023-10-09] [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page #26945

Closed
3 of 6 tasks
izarutskaya opened this issue Sep 7, 2023 · 42 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Sep 7, 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!


Action Performed:

  1. Launch app
  2. Tap fab
  3. Tap request money
  4. Tap distance
  5. Tap Start and select an address
  6. Tap Finish and select an address
  7. Tap next
  8. Select a workspace
  9. Note the Request money amount
  10. Navigate back to Request money page
  11. Tap Manual

Expected Result:

The Distance IOU amount should not be displayed in manual request money page.

Actual Result:

The Distance IOU amount is auto-filled and displayed in manual request money page.

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.65-0

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6191091_manual.mp4

Expensify/Expensify Issue URL:

Issue reported by: @ashimsharma10

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693999827026719

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01baf90b8cc8571594
  • Upwork Job ID: 1702484361858043904
  • Last Price Increase: 2023-09-15
  • Automatic offers:
    • cubuspl42 | Reviewer | 26852371
    • tienifr | Contributor | 26852372
    • ashimsharma10 | Reporter | 26852374
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 7, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 7, 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

@akinwale
Copy link
Contributor

akinwale commented Sep 7, 2023

Proposal

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

IOU amount is autofilled and displayed in manual request page when editing Distance request.

What is the root cause of that problem?

The amount prop for the MoneyRequestAmountForm component on NewRequestAmountPage is set to iou.amount which retrieves the saved amount from Onyx.

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

Solution 1
Conditionally set the amount prop for MoneyRequestAmountForm on NewRequestAmountPage based on the isEditing flag. This is based on the assumption that every new money request should have the initial value as 0. On the other hand, if the value is being edited, it should pick up the Onyx data.

-amount={iou.amount}
+amount={isEditing ? iou.amount : 0}

Solution 2
Clear the iou from Onyx when the user navigates away from the Distance request page, or when the NewRequestAmountPage comes into focus.

Solution 3
Do not set the amount prop value for MoneyRequestAmountForm on NewRequestAmountPage if the page is not in focus. We can use a state variable and then make use of the useIsFocused navigation hook to check this.

What alternative solutions did you explore? (Optional)

None.

@joh42
Copy link
Contributor

joh42 commented Sep 7, 2023

Proposal

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

When we go to the manual money request tab after starting a distance request, the amount from the distance request remains.

What is the root cause of that problem?

We already reset the data when the tab changes:

const resetMoneyRequestInfo = () => {
const moneyRequestID = `${iouType}${reportID}`;
IOU.resetMoneyRequestInfo(moneyRequestID);
};

The problem is that when the manual data tab renders, the new amount value has not yet been reset in Onyx. When it is reset, we do not change the amount since there is a condition returning early if !amount:

if (!currency || !amount) {
return;
}

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

I suggest we update the aforementioned condition so that we still set the amount if it is 0:

    if (!currency || (!amount && amount !== 0)) {
        return;
    }

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@joh42
Copy link
Contributor

joh42 commented Sep 7, 2023

Demo of my proposed solution:

Screen.Recording.2023-09-07.at.13.59.52.mov

@joh42
Copy link
Contributor

joh42 commented Sep 7, 2023

Also as per this comment we want to clear the data when we switch between request types: #26579 (comment)

We still want to reset the money request information because we are sharing the data for a draft money request. If we don't clear the data when a different tab/request type is selected, draft data from the previous type might be included in the new money request.

@alexpensify
Copy link
Contributor

I've run out of time today and will test soon.

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@alexpensify
Copy link
Contributor

Still on my testing list

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 14, 2023
@alexpensify alexpensify added the External Added to denote the issue can be worked on by a contributor label Sep 15, 2023
@melvin-bot melvin-bot bot changed the title Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page Sep 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 15, 2023

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

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

melvin-bot bot commented Sep 15, 2023

Current assignee @alexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Sep 15, 2023

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

@alexpensify
Copy link
Contributor

@cubuspl42 - when you get a chance, can you please review if the proposals will address this issue? Thanks!

@melvin-bot melvin-bot bot removed the Overdue label Sep 15, 2023
@tienifr
Copy link
Contributor

tienifr commented Sep 15, 2023

Proposal

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

The Distance IOU amount is auto-filled and displayed in manual request money page.

What is the root cause of that problem?

  1. In here we're resetting the money request when the user presses another tab, that logic is not robust, if the user navigates to that tab by another means (like if currently on Distance, then go to /manual link), the reset will not be triggered. So the issue in the OP can be reproduced in that scenario as well.

  2. Even if the reset is triggered, in here we don't update the value if it's falsy, so when we reset, the amount is 0 so it will not update.

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

  1. In MoneyRequestSelectorPage, we need to clear the value whenever the selectedTab changes (not just on tabPress), this can be done by using useEffect and usePrevious. After that logic is added, we can optionally remove this logic since it's no longer necessary.
const prevSelectedTab = usePrevious(props.selectedTab);

useEffect(() => {
    if (prevSelectedTab === props.selectedTab) {
        return;   
    }

    resetMoneyRequestInfo();
}, [props.selectedTab, prevSelectedTab]);
  1. In here, we should update !amount to a condition that checks the amount is a valid number, so if amount is 0, it should still trigger the update.
!_.isNumber(amount)

What alternative solutions did you explore? (Optional)

Another way for 1 is, we can store the money request method in ONYXKEYS.IOU as well. If we see that the IOU request method is different from the tab we're in, we'll reset the IOU.

@cubuspl42
Copy link
Contributor

@izarutskaya @alexpensify

I think that the "expected result" should not be just the "actual result", but negated. What amount should actually be displayed? 0?

@melvin-bot melvin-bot bot added the Overdue label Sep 18, 2023
@alexpensify
Copy link
Contributor

Yeah, I think 0 makes sense.

@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 2, 2023
@melvin-bot melvin-bot bot changed the title [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page [HOLD for payment 2023-10-09] [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page Oct 2, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.75-12 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-10-09. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 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:

  • [@cubuspl42] The PR that introduced the bug has been identified. Link to the PR:
  • [@cubuspl42] 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:
  • [@cubuspl42] 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:
  • [@cubuspl42] Determine if we should create a regression test for this bug.
  • [@cubuspl42] 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.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 3, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-09] [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page [HOLD for payment 2023-10-10] [HOLD for payment 2023-10-09] [$500] Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.76-6 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-10-10. 🎊

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:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 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:

  • [@cubuspl42] The PR that introduced the bug has been identified. Link to the PR:
  • [@cubuspl42] 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:
  • [@cubuspl42] 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:
  • [@cubuspl42] Determine if we should create a regression test for this bug.
  • [@cubuspl42] 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.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@alexpensify
Copy link
Contributor

@cubuspl42 - to prepare for the payment date, can you please complete the checklist? Thanks!

@cubuspl42
Copy link
Contributor

cubuspl42 commented Oct 6, 2023

  • The PR that introduced the bug has been identified. Link to the PR:
  • 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:
  • 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:
    • No need for additional discussion
  • Determine if we should create a regression test for this bug.
    • Up to the QA team
  • 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.
    • Launch the app.
    • Tap the Floating Action Button (FAB).
    • Select the 'Request Money' option.
    • Access the 'Distance' feature.
    • Click on 'Start' and choose a specific address.
    • Click on 'Finish' and designate a different address.
    • Proceed by tapping 'Next'.
    • Choose your preferred workspace.
    • Take note of the 'Request Money' amount displayed.
    • Navigate back to the 'Request Money' page.
    • Select the 'Manual' option.
    • Confirm that no amount is set (you should see a slightly greyed-out 0)

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Oct 9, 2023
@alexpensify
Copy link
Contributor

My mistake, I missed that there was a regression here but was addressed quickly. I need another day to review and confirm the payment amounts. For now, I've paid the reporter.

@alexpensify
Copy link
Contributor

alexpensify commented Oct 12, 2023

Here is the payment summary:

Upwork Job: https://www.upwork.com/jobs/~01baf90b8cc8571594

*If applicable, the bonuses will be applied on the final payment

Extra Notes regarding payment: This GH would fall under an urgency bonus but due to regression there won't be one. We did fix the issue quickly, so I'll be keeping the base pay as is for the contributors.

@alexpensify
Copy link
Contributor

Everyone has been paid in Upwork. I need to create the regression test and will close it.

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

@cubuspl42, @marcochavezf, @alexpensify, @tienifr Whoops! This issue is 2 days overdue. Let's get this updated quick!

@alexpensify
Copy link
Contributor

Not overdue, I need to create the regression test.

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@cubuspl42
Copy link
Contributor

  • Contributor that fixed the issue @cubuspl42 $500

  • Contributor+ that helped on the issue and/or PR @tienifr $500

It's the opposite, but doesn't matter much I guess

@alexpensify
Copy link
Contributor

Alright, I updated the summary based on the @cubuspl42 feedback Also, I created the regression test, so I'm going to close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

7 participants