Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.49k stars 2.85k forks source link

[HOLD for payment 2024-07-10] [Search v1] - Scanning expense displays 0.00 in Total column and the Merchant column is blank #43474

Closed m-natarajan closed 3 months ago

m-natarajan commented 4 months ago

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.81-8 Reproducible in staging?: y Reproducible in production?: new feature 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 staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit a scan expense.
  4. While the receipt is scanning, go to Search.

Expected Result:

The scanning expense will display "Scanning" in Merchant and Total column, similar to transaction thread.

Actual Result:

The scanning expense displays 0.00 in Total column, and the Merchant column is blank.

Workaround:

unknown

Platforms:

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

Screenshots/Videos

https://github.com/Expensify/App/assets/38435837/60340ad0-ad1b-42c9-8dd3-7736fc948361

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @garrettmknight
melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

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

github-actions[bot] commented 4 months ago

:wave: 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.
m-natarajan commented 4 months ago

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

m-natarajan commented 4 months ago

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

etCoderDysto commented 4 months ago

Proposal

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

Scanning expenses display 0.00 in the Total column, and the Merchant column is blank.

What is the root cause of that problem?

transactionItem.formattedMerchantand transactionItem.formattedMerchant are displayed without checking if a scan request state is "SCANNING". There is no state property on transactionItem.receipt for TotalCell and MerchantCell. Therefore we can't determine if the scan transaction state is "SCANNING" following the same pattern used on MoneyRequestView. This is because BE doesn't return transaction.receipt.state value on a transaction object for Search query, but it does for RequestMoney query.

Search query BE response

Screenshot 2024-06-12 at 5 21 29 in the afternoon

RequestMoney query BE response

Screenshot 2024-06-12 at 5 22 16 in the afternoon

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

What alternative solutions did you explore? (Optional)

N/A

carlosmiceli commented 4 months ago

Looking at the checklist, I don't think this is a deploy blocker, but it does look like a bug that could be External.

melvin-bot[bot] commented 4 months ago

Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

melvin-bot[bot] commented 4 months ago

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

mollfpr commented 4 months ago

Checking 👀

carlosmiceli commented 4 months ago

@garrettmknight question, why does it say "Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue." when adding the External label?

luacmartins commented 4 months ago

@JmillsExpensify @trjExpensify what's the expected behavior here?

Tony-MK commented 4 months ago

Proposal

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

Scanning expense displays 0.00 in Total column and the Merchant column is blank

What is the root cause of that problem?

The root cause of the problem is that the MerchantCell, TotalCell, and the TaxCell in the TransactionListItemRow does not check if the receipt is being scanned.

Therefore, the TransactionListItemRow will show the transactionItem.formattedMerchant which is an empty string.

https://github.com/Expensify/App/blob/4f2901f5b72a90ad56ff17150c93476fb1166886/src/components/SelectionList/Search/TransactionListItemRow.tsx#L108

Also, both the TotalCell and the TaxCell rows will show zero.

https://github.com/Expensify/App/blob/4f2901f5b72a90ad56ff17150c93476fb1166886/src/components/SelectionList/Search/TransactionListItemRow.tsx#L121

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

Hence, we should check if the transaction has a receipt and is being scanned so we should show scanning in those cells.

We check with the following condition illustrated below.

transactionItem.hasEReceipt && TransactionUtils.isReceiptBeingScanned(transactionItem) 

For the MerchantCell, we can change the text prop to something like the one below.

text={transactionItem.shouldShowMerchant ? (transactionItem.hasEReceipt && TransactionUtils.isReceiptBeingScanned(transactionItem) ? transactionItem.formattedMerchant : translate('iou.receiptStatusTitle')) : description}

For the TotalCell and the TaxCell, we can change the text prop to something like the one below.

text={transactionItem.hasEReceipt && TransactionUtils.isReceiptBeingScanned(transactionItem) ? translate('iou.receiptStatusTitle') : CurrencyUtils.convertToDisplayString(transactionItem.formattedTotal, currency)}

What alternative solutions did you explore? (Optional)

We can change the TransactionUtils.getDescription function to return scanning if the receipt is scanning and transactionItem.shouldShowMerchant is false.

trjExpensify commented 4 months ago

@JmillsExpensify @trjExpensify what's the expected behavior here?

Great question! I don't think we really considered this initially. We could go with the Scanning... in the merchant and amount fields, or we could do something more visual on the row to signal that it's in the scanning state perhaps?

CC: @Expensify/design for thoughts!

shawnborton commented 4 months ago

I am down with that as an easy place to start.

dannymcclain commented 4 months ago

I am down with that as an easy place to start.

Agree. This seems like the most straight forward approach to fix this quickly. I'm not against trying to improve it, but I like starting here.

etCoderDysto commented 4 months ago

Updated my proposal expounding on my alternative solution and discarding my main solution.

garrettmknight commented 4 months ago

@garrettmknight question, why does it say "Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue." when adding the External label?

@carlosmiceli sometimes the automation fails so the BZ team member has to create the Upwork job manually. Typically, I just create a separate issue like this and add External to run the automation again.

garrettmknight commented 4 months ago

Upwork Job for this issue

mollfpr commented 4 months ago

@Tony-MK The merchant field shows Scanning even though the expense is scanned.

Screenshot 2024-06-14 at 00 15 00


The proposal from @etCoderDysto looks good to me!

🎀 👀 🎀 C+ reviewed!

melvin-bot[bot] commented 4 months ago

Current assignees @luacmartins and @carlosmiceli are eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

etCoderDysto commented 4 months ago

Thank you! I will raise a pr ASAP.

luacmartins commented 4 months ago

It looks like the selected proposal relies on backend changes. @carlosmiceli are you available to work on that?

carlosmiceli commented 4 months ago

Yes! I'll wait for that PR and then do the BE part.

luacmartins commented 4 months ago

Hmm I think the App PR depends on the backend providing this data, no? So shouldn't we start with the BE PR?

carlosmiceli commented 4 months ago

Ah, good point, I skimmed it quickly and didn't think of the best order. I'll work on it as soon as I can 🙏

etCoderDysto commented 4 months ago

I will raise a pr once the BE pr is merged.

etCoderDysto commented 4 months ago

Hi @mollfpr this is my first PR, and I want to check if it is alright to apply on other issues until BE pr is merged?

New contributors are limited to working on one job at a time

I have seen the above guidline but I wanted to make sure if it is alright to apply on other issues until the BE pr is merged.

garrettmknight commented 4 months ago

Hey @etCoderDysto - since this one is held on raising the BE, you can apply to other issues. Feel free to link this comment as proof of approval.

etCoderDysto commented 4 months ago

Hey @etCoderDysto - since this one is held on raising the BE, you can apply to other issues. Feel free to link this comment as proof of approval.

Thank you, Garrett🙇‍♂️

luacmartins commented 4 months ago

@etCoderDysto I think you could get started on your PR too and assume that the API response would include the receipt state. We'd have to wait on the backend changes to test it properly though.

etCoderDysto commented 4 months ago

@etCoderDysto I think you could get started on your PR too and assume that the API response would include the receipt state. We'd have to wait on the backend changes to test it properly though.

Great! I will do that.

mollfpr commented 4 months ago

Not overdue Melv!

melvin-bot[bot] commented 4 months ago

@carlosmiceli, @garrettmknight, @luacmartins, @mollfpr, @etCoderDysto Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

garrettmknight commented 4 months ago

Not overdue, just waiting on BE progress so we can unlock everything.

carlosmiceli commented 4 months ago

Came back today from OOO, trying to catch up some things and ideally I should be able to start this tomorrow.

carlosmiceli commented 4 months ago

@luacmartins added you as reviewer for the Auth fix.

luacmartins commented 4 months ago

Approved & merged

etCoderDysto commented 4 months ago

@mollfpr PR is ready for review.

melvin-bot[bot] commented 3 months ago

⚠️ 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.

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.3-7 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-07-10. :confetti_ball:

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

melvin-bot[bot] commented 3 months ago

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:

melvin-bot[bot] commented 3 months ago

Payment Summary

[Upwork Job]()

BugZero Checklist (@garrettmknight)

garrettmknight commented 3 months ago

Payment Summary:

@etCoderDysto offer out to you in Upwork

etCoderDysto commented 3 months ago

I have accepted the offer. Thank you!

garrettmknight commented 3 months ago

Contributor paid, dropping to weekly for reveiwer to request.

mollfpr commented 3 months ago

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR: [@mollfpr] 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:

No offending PR was found.

[@mollfpr] 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:

The regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug. [@mollfpr] 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.

  1. Go to workspace chat.
  2. Submit a scan expense.
  3. While the receipt is scanning, go to Search.
  4. Verify that the 'Scanning...' message is displayed on the Merchant and Total fields
  5. After the receipt finishes scanning return back to the Search page
  6. Verify that the scan result is displayed on the Merchant and Total fields instead of the 'Scanning...' message
  7. 👍 or 👎
JmillsExpensify commented 3 months ago

$250 approved for @mollfpr

luacmartins commented 3 months ago

We'll add tests as part of the project wrap up, so no need to do that now.