App icon indicating copy to clipboard operation
App copied to clipboard

Expense - Receipt added after creating expense changes amount & merchant field to scanning

Open IuliiaHerets opened this issue 1 year ago • 3 comments

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: V9. 0.71-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both If this was caught during regression testing, add the test name, ID and link from TestRail: N Email or phone of affected tester (no customers): N Issue reported by: Applause Internal Team

Action Performed:

  1. Launch app
  2. Go to workspace - new workspace
  3. Tap category
  4. Enter gl and payroll code
  5. Save the category
  6. Tap settings - toggle on member must categorize all expense
  7. Tap on workspace chat from workspace settings page
  8. Create a expense entering big amount and merchant
  9. Open the expense and upload a receipt using camera
  10. In few seconds, amount and merchant changed to scanning
  11. Open amount and merchant field and close
  12. Note after minutes scanning is shown in amount and merchant field.
  13. Go back to conversation page
  14. Open expense again
  15. Now amount and merchant displayed

Expected Result:

Receipt added after creating expense changes amount & merchant field to scanning must display correct value.

Actual Result:

Receipt added after creating expense changes amount & merchant field to scanning and it resets to correct value only while revisit the page.

Note: scanning text remains and only after revisiting page or refreshing page(mweb) , amount and merchant field displayed again.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/18a0a6f8-24bb-4ef1-9410-6f4b563c4e3f

View all open jobs on GitHub

IuliiaHerets avatar Dec 04 '24 09:12 IuliiaHerets

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[bot] avatar Dec 04 '24 09:12 melvin-bot[bot]

Edited by proposal-police: This proposal was edited at 2024-12-04 23:48:10 UTC.

Proposal

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

Expense - Receipt added after creating expense changes amount & merchant field to scanning

What is the root cause of that problem?

Whenever the receipt of the transaction is being scanned we are showing scanning for both amount and merchant here https://github.com/Expensify/App/blob/64829131fe962681626b4b016140521d05f7fe52/src/components/ReportActionItem/MoneyRequestView.tsx#L213-L215

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

We should display scanning only if the transaction amount doesn't exist or is zero (or we can also use isScanRequest check to properly determine that the request is scan type whose amount is waiting to be scanned) so we can update it to

if (TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction) && !transactionAmount) {
        merchantTitle = translate('iou.receiptStatusTitle');
        amountTitle = translate('iou.receiptStatusTitle');
    }

We can optionally separate the merchantTitle and only show scanning when transaction merchant is empty (or using the existing condition of isEmptyMerchant) or even show scanning for merchant whenever the receipt is being scanning according to the suggestions of the design team

If needed we can apply similar fixes here and here

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We can test it by rendering (via @testing-library/react-native) the component money request view after populating onyx with all necessary data and mocking to successfully render it, most importantly linked to this issue setting the transaction.receipt.state to scanning and setting the transaction amount and merchant field as needed and assert that the menu for amount and merchant have the correct values (not scanning...). We can assert by getByText to check that a text node with that value exists or we can either giving a testID and checking for the correct values as needed

What alternative solutions did you explore? (Optional)

FitseTLT avatar Dec 04 '24 11:12 FitseTLT

I haven't' had a chance to review. Will look at this this weekend or first thing Monday morning

OfstadC avatar Dec 06 '24 21:12 OfstadC

I'm fairly certain this is intended behavior. It's returning to the original set Merchant & Amount when the receipt is done scanning. In this case the receipt did not have a merchant or amount.

Although i'm not 100% sure what is expected if the merchant or amount was scanned off the receipt and differed from the manually entered info.

For card expenses, historically we've taken the scanned merchant but not sure if that's the case here 🤔

OfstadC avatar Dec 09 '24 17:12 OfstadC

I'm fairly certain this is intended behavior. It's returning to the original set Merchant & Amount when the receipt is done scanning. In this case the receipt did not have a merchant or amount.

Although i'm not 100% sure what is expected if the merchant or amount was scanned off the receipt and differed from the manually entered info.

For card expenses, historically we've taken the scanned merchant but not sure if that's the case here 🤔

From my observation @OfstadC The manually set amount and merchant are not overrode by scan results here is a demo: the receipt has both amount and merchant but it remained in the manual value set initially.

https://github.com/user-attachments/assets/e98cc68f-3293-4f1a-9d13-99de785d3b14

FitseTLT avatar Dec 09 '24 20:12 FitseTLT

From my observation @OfstadC The manually set amount and merchant are not overrode by scan results here is a demo: the receipt has both amount and merchant but it remained in the manual value set initially.

Interesting 🤔 .

OfstadC avatar Dec 11 '24 14:12 OfstadC

Asked about this here - https://expensify.slack.com/archives/C06ML6X0W9L/p1734034230368829

OfstadC avatar Dec 12 '24 20:12 OfstadC

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

melvin-bot[bot] avatar Dec 16 '24 09:12 melvin-bot[bot]

Seems like we do want to fix this. Just waiting to confirm if this is External or Internal

OfstadC avatar Dec 17 '24 18:12 OfstadC

@OfstadC this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 18 '24 09:12 melvin-bot[bot]

I believe we do want to scan the receipt (background scan), but it shouldn't be blocking the merchant, amount when completing

OfstadC avatar Dec 18 '24 20:12 OfstadC

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

melvin-bot[bot] avatar Dec 18 '24 20:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 18 '24 20:12 melvin-bot[bot]

@OfstadC, @rayane-djouah Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Dec 24 '24 09:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 25 '24 16:12 melvin-bot[bot]

@OfstadC, @rayane-djouah Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Dec 26 '24 09:12 melvin-bot[bot]

Will get to this one soon

rayane-d avatar Dec 26 '24 22:12 rayane-d

@OfstadC, @rayane-djouah Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 30 '24 09:12 melvin-bot[bot]

@OfstadC @rayane-djouah 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!

melvin-bot[bot] avatar Jan 01 '25 09:01 melvin-bot[bot]

@OfstadC, @rayane-djouah Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Jan 01 '25 09:01 melvin-bot[bot]

I was OOO and catching up on issues today. I will review the existing proposal today.

rayane-d avatar Jan 01 '25 11:01 rayane-d

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

melvin-bot[bot] avatar Jan 01 '25 16:01 melvin-bot[bot]

I believe we do want to scan the receipt (background scan), but it shouldn't be blocking the merchant, amount when completing

@OfstadC Is this correct:

BUG:

Amount and merchant fields stay stuck on "scanning" after adding a receipt until navigating away and back.

Action Performed:

  1. Open your workspace chat.
  2. Create a manual expense with a specified amount and merchant.
  3. Open the expense and upload a receipt.
  4. Observe that after a few seconds, the amount and merchant fields change to "scanning."
  5. Note that the "scanning" status persists and does not update to the correct values, even after several minutes.
  6. Navigate back to the conversation page.
  7. Reopen the expense.
  8. Observe that the amount and merchant fields now display the correct values instead of "scanning."

Expected Result:

Once the scan is completed, the amount and merchant fields should automatically update and display the correct values without requiring the user to navigate away and return.

Actual Result:

The "scanning" status remains stuck in the amount and merchant fields until the user navigates away and reopens the expense.

rayane-d avatar Jan 01 '25 23:01 rayane-d

So, we want to retain the "Scanning" message but ensure it disappears automatically once the scan is completed?

rayane-d avatar Jan 01 '25 23:01 rayane-d

I don’t think we should display scanning because scanning never affects manually set amount and merchant so why will hide them until the scanning is done which doesn’t even alter them.

On Thu, 2 Jan 2025 at 2:14 AM rayane-djouah @.***> wrote:

So, we want to retain the "Scanning" message but ensure it disappears automatically once the scan is completed?

— Reply to this email directly, view it on GitHub https://github.com/Expensify/App/issues/53535#issuecomment-2567177220, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJG4AZOYHBJM6RJMKVY5IKT2IRZFTAVCNFSM6AAAAABS7XU6SGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRXGE3TOMRSGA . You are receiving this because you commented.Message ID: @.***>

FitseTLT avatar Jan 01 '25 23:01 FitseTLT

@OfstadC, @rayane-djouah Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Jan 07 '25 09:01 melvin-bot[bot]

scanning never affects manually set amount and merchant

I tested and it seems that it affects manually set amount and merchant:

https://github.com/user-attachments/assets/672be478-e624-4b9b-89f9-906348ab94d2

rayane-d avatar Jan 07 '25 15:01 rayane-d

@rayane-djouah I am observing that the value is updated when smart scanning is done (modifiedAmount and modifiedMerchant) but it will revert to the manual set values on page refresh (both modifiedAmount and modifiedMerchant then get reset)

https://github.com/user-attachments/assets/fc094f4f-390e-4811-8a66-0adea8a52618

FitseTLT avatar Jan 08 '25 15:01 FitseTLT

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

melvin-bot[bot] avatar Jan 08 '25 16:01 melvin-bot[bot]

Issue not reproducible during KI retests. (First week)

mvtglobally avatar Jan 12 '25 05:01 mvtglobally