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 2024-03-07] [$500] [MEDIUM] Scan - Merchant message disappears after deleting receipt and reappears after adding receipt #34997

Closed
6 tasks done
lanitochka17 opened this issue Jan 23, 2024 · 35 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

@lanitochka17
Copy link

lanitochka17 commented Jan 23, 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.30-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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to workspace chat
  2. Create a scan request
  3. While the scanning is ongoing, navigate to the request details page and manually enter amount
  4. Click on the receipt and delete it
  5. Add a receipt

Expected Result:

Since merchant is a requirement for workspace request, the merchant requirement message will remain until a merchant is entered

Actual Result:

After deleting the receipt while merchant is empty, the merchant message disappears. After adding a receipt, the message reappears

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

Bug6352447_1706038465358.20240123_234633.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f34025c8418af8d7
  • Upwork Job ID: 1749884467102949376
  • Last Price Increase: 2024-01-23
  • Automatic offers:
    • c3024 | Reviewer | 28142586
    • dukenv0307 | Contributor | 28142587
@lanitochka17 lanitochka17 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 Jan 23, 2024
Copy link

melvin-bot bot commented Jan 23, 2024

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

@melvin-bot melvin-bot bot changed the title Scan - Merchant message disappears after deleting receipt and reappears after adding receipt [$500] Scan - Merchant message disappears after deleting receipt and reappears after adding receipt Jan 23, 2024
Copy link

melvin-bot bot commented Jan 23, 2024

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

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

melvin-bot bot commented Jan 23, 2024

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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave6.
CC @greg-schroeder

@Nodebrute
Copy link
Contributor

Nodebrute commented Jan 23, 2024

Proposal

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

Merchant error message disappeared even it's a policy chat

What is the root cause of that problem?

The problem starts here

let hasErrors = false;
if (hasReceipt) {
receiptURIs = ReceiptUtils.getThumbnailAndImageURIs(transaction);
hasErrors = canEdit && TransactionUtils.hasMissingSmartscanFields(transaction);
}

hasErrors is true when we have required empty fields after scanning. When we delete a receipt, hasReceipt becomes false, indicating that the corresponding hasErrors will also be false, and no error will be displayed.

error={hasErrors && isPolicyExpenseChat && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}

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

We can change this to

error={hasErrors && isPolicyExpenseChat && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}

error={!TransactionUtils.isReceiptBeingScanned(transaction) && isPolicyExpenseChat && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}

The error will be displayed only when we don't have a receipt being scanned, and it is a policy expense chat and merchant is empty.

What alternative solutions did you explore? (Optional)

We can add another check !TransactionUtils.isReceiptBeingScanned(transaction) here

error={hasErrors && isPolicyExpenseChat && isEmptyMerchant ? translate('common.error.enterMerchant') : ''}

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 23, 2024

Proposal

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

  • Scan - Merchant message disappears after deleting receipt and reappears after adding receipt

What is the root cause of that problem?

  • Here is the condition that we use to display the merchant error. In this bug, hasErrors field is false because we just set it to true in:
    if (hasReceipt) {
    receiptURIs = ReceiptUtils.getThumbnailAndImageURIs(transaction);
    hasErrors = canEdit && TransactionUtils.hasMissingSmartscanFields(transaction);
    }
  • When we delete the receipt, the hasReceipt is false, that leads to the above logic is not called

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

  • We need to have a way to differentiate manual requests with an attached receipt from a smartscan request once the server returns the response.
  • Then, just need to update:
    let hasErrors = false;
    if (hasReceipt) {
    receiptURIs = ReceiptUtils.getThumbnailAndImageURIs(transaction);
    hasErrors = canEdit && TransactionUtils.hasMissingSmartscanFields(transaction);
    }

    to:
    let hasErrors = false
    if (hasReceipt) {
        receiptURIs = ReceiptUtils.getThumbnailAndImageURIs(transaction);
    }
    if(isScanRequest){
        hasErrors = canEdit && TransactionUtils.hasMissingSmartscanFields(transaction);
    }
  • In the above, isScanRequest can be returned from BE side

What alternative solutions did you explore? (Optional)

    let hasErrors = false
    if (hasReceipt) {
        receiptURIs = ReceiptUtils.getThumbnailAndImageURIs(transaction);
    }
    hasErrors = canEdit && TransactionUtils.hasMissingSmartscanFields(transaction);

@dukenv0307
Copy link
Contributor

@c3024 What do you think about my proposal here?

@melvin-bot melvin-bot bot added the Overdue label Jan 26, 2024
@c3024
Copy link
Contributor

c3024 commented Jan 26, 2024

I'll update in a few hours. Thanks for the bump.

@c3024
Copy link
Contributor

c3024 commented Jan 27, 2024

We don't show RBR and error for the required fields when they are empty only while the receipt is scanned. The empty field check is already being done so checking whether the receipt is scanned as suggested by @Nodebrute is I think the correct way to fix this. However, this change should be done for all required fields as well as the brick indicator field.

In cases when there is no receipt, setting hasErrors to true purely based on canEdit as suggested by @dukenv0307 gives the meaning of having errors just because the request is editable which is inconsistent with the variable name hasErrors. Further, with violations enabled setting hasErrors to true causes a regression showing a danger border for the ReceiptEmptyState for simple manual money requests.

So, the proposal here by @Nodebrute looks good to me.

🎀 👀 🎀 C+ Reviewed

Copy link

melvin-bot bot commented Jan 27, 2024

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

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 27, 2024

  • @c3024 The errors just need to be displayed in case of smartscan, right? (see PR).

  • Currently, we do not have a way to differentiate manual requests with an attached receipt from a smartscan request once the server returns the response. Instead, we are using hasReceipt to check, but it is not correctly.

  • So my suggestion is that we need to add a variable to check this in BE as we `ve proposed here, then use it as I mentioned in my updated proposal. What do you think?

@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
@kadiealexander
Copy link
Contributor

@Julesssss bump!

@melvin-bot melvin-bot bot removed the Overdue label Jan 30, 2024
@dukenv0307
Copy link
Contributor

@c3024 Also, the solution here will lead to regression #34195

@Julesssss
Copy link
Contributor

I was sick, but it looks like we should now discuss @dukenv0307's points before committing to the proposal.

@c3024:

So my suggestion is that we need to add a variable to check this in BE as we `ve proposed here, then use it as I mentioned in my #34997 (comment). What do you think?

@greg-schroeder greg-schroeder changed the title [$500] Scan - Merchant message disappears after deleting receipt and reappears after adding receipt [$500] [MEDIUM] Scan - Merchant message disappears after deleting receipt and reappears after adding receipt Jan 31, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Feb 6, 2024
@dukenv0307
Copy link
Contributor

@c3024 PR #35871 is ready to review

This comment was marked as off-topic.

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

This issue has not been updated in over 15 days. @Julesssss, @kadiealexander, @c3024, @dukenv0307 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Feb 29, 2024
@dukenv0307
Copy link
Contributor

The PR is merged.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Monthly KSv2 labels Feb 29, 2024
@melvin-bot melvin-bot bot changed the title [$500] [MEDIUM] Scan - Merchant message disappears after deleting receipt and reappears after adding receipt [HOLD for payment 2024-03-07] [$500] [MEDIUM] Scan - Merchant message disappears after deleting receipt and reappears after adding receipt Feb 29, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

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

Copy link

melvin-bot bot commented Feb 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.45-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 2024-03-07. 🎊

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

Copy link

melvin-bot bot commented Feb 29, 2024

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:

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

@c3024
Copy link
Contributor

c3024 commented Mar 1, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: Display Smartscan errors #26155
  • [@c3024] 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: https://github.com/Expensify/App/pull/26155/files#r1509172991
  • [@c3024] 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: This happens only when the user enters amount before the scan is complete and then removes the receipt. This is an uncommon case and this is difficult to be identified. So, no discussion has been started.
  • [@c3024] Determine if we should create a regression test for this bug. Yes
  • [@c3024] 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.

Regression Test Proposal

  1. Go to workspace chat
  2. Create a scan request
  3. While the scanning is ongoing, navigate to the request details page and manually enter amount leaving Merchant field empty
  4. Verify that there is an error and RBR at the Merchant field
  5. Click on the receipt and delete it
  6. Verify that the error and RBR stay at the 'Merchant' field
  7. Add a receipt
  8. Verify that the error and RBR stay at the 'Merchant' field

👍 or 👎

Copy link

melvin-bot bot commented Mar 4, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@s77rt
Copy link
Contributor

s77rt commented Mar 4, 2024

Ignore ^

@kadiealexander
Copy link
Contributor

kadiealexander commented Mar 7, 2024

Payouts due:

Upwork job is here.

@kadiealexander kadiealexander added Daily KSv2 and removed Weekly KSv2 labels Mar 7, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Mar 7, 2024
@kadiealexander
Copy link
Contributor

Issue for adding steps to Testrail: https://github.com/Expensify/Expensify/issues/376654

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
No open projects
Development

No branches or pull requests

7 participants