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

[$500] Scan - Request count in expense preview is reduced by one when there is a scanning request #37981

Closed
6 tasks done
lanitochka17 opened this issue Mar 8, 2024 · 13 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 8, 2024

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: 1.4.49-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: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  • Admin and employee are in the same workspace
  1. Go to staging.new.expensify.com
  2. [Admin] Open workspace chat with employee
  3. [Employee] Create a manual request
  4. [Employee] Create a scan request
  5. [Employee] Create another manual request
  6. [Admin] Click on the expense preview
  7. [Admin] Return to main workspace chat via header subtitle

Expected Result:

The expense preview will display "2 requests, 1 scanning" because there are 2 manual requests and 1 hidden request

Actual Result:

The expense preview will display "1 request, 1 scanning" when there are 2 manual requests and 1 hidden request

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

Bug6407013_1709908802762.20240308_222404.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0135166f6fdd577501
  • Upwork Job ID: 1766977397984571392
  • Last Price Increase: 2024-03-11
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 8, 2024
Copy link

melvin-bot bot commented Mar 8, 2024

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

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave5
CC @dylanexpensify

@lanitochka17
Copy link
Author

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

@Tony-MK
Copy link
Contributor

Tony-MK commented Mar 9, 2024

Proposal

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

Scan - Request count in expense preview is reduced by one when there is a scanning request

What is the root cause of that problem?

In the ReportPreview action, the reportPreviewAction?.childMoneyRequestCount is used to calculate the numberOfRequests in the getNumberOfMoneyRequests.

The numberOfRequests is one less for the recipient because of the scanning receipt which can be used.

const numberOfRequests = ReportActionUtils.getNumberOfMoneyRequests(action);

That is why, in the MoneyRequestPreview, the number of money request actions is on two money requests instead of three.

count: numberOfRequests - numberOfScanningReceipts - numberOfPendingRequests,
scanningReceipts: numberOfScanningReceipts,
pendingReceipts: numberOfPendingRequests,

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

When calculating the numberOfRequests to display, we should account for the number of scanning receipts that the user can have not create or edit.

Therefore, we will create a constant number called numberOfScanningReceiptsNotCreated to subtract from numberOfScanningReceipts to get the number of scanned receipts created by the user.

Psuedo-code

numberOfScanningReceipts: numberOfRequests - (numberOfScanningReceipts - numberOfScanningReceiptsNotCreated) - numberOfPendingRequests

@allgandalf
Copy link
Contributor

@Tony-MK , were you able to reproduce this one ? I tried to but no luck or did i miss something?

@melvin-bot melvin-bot bot added the Overdue label Mar 10, 2024
@mallenexpensify mallenexpensify added the External Added to denote the issue can be worked on by a contributor label Mar 11, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

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

@melvin-bot melvin-bot bot changed the title Scan - Request count in expense preview is reduced by one when there is a scanning request [$500] Scan - Request count in expense preview is reduced by one when there is a scanning request Mar 11, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 11, 2024
Copy link

melvin-bot bot commented Mar 11, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Mar 11, 2024
@mallenexpensify
Copy link
Contributor

I was able to reproduce . @shubham1206agra , can you also please try then review the proposal above? Thx
image

@tienifr
Copy link
Contributor

tienifr commented Mar 11, 2024

Proposal

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

The expense preview will display "1 request, 1 scanning" when there are 2 manual requests and 1 hidden request

What is the root cause of that problem?

When the money request submitted from the Employee is scanning, it's considered as a hidden request ("Whisper report action" to the Employee) and will not show in the Admin side in the IOU. We can validate that by going to the IOU in the above case for Admin account in the OP, there'll only be 2 money requests, it's also evident in the code here.

However, when getting the transactions to show in the Report preview here, we're not filtering out the "hidden" transactions, meanwhile the childMoneyRequestCount of the report preview report action will return 2 correctly (excluding the "hidden" transaction). That's why we'll see "1 request, 1 scanning" in the report preview, while it should be "2 requests". The "1 scanning" should not show because the scanning is Employee-whisper-only, and it will be confusing to the Admin because when clicking the report preview, they will not see any "scanning" request.

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

  1. In here, we should filter out the transactions that are "hidden". We can do that by:
  • Get the list of IOU report actions of the iouReportID, which are "whisper actions targeted to others" (by using this method
  • From those IOU report actions, get the list of transactionIDs, we can use the originalMessage.IOUTransactionID field. These are the "hidden" transactions

We can optionally do the above inside a lower-level method like getTransactionsWithReceipts or getAllReportTransactions so this problem (hidden transaction still showing) will not appear in other places.

  1. It seems that when the employee first created the scanning, the back-end will send Pusher updates which counts the "hidden" request into the childMoneyRequestCount of the report preview action. When refreshing however, the childMoneyRequestCount will be correct (not including the hidden report action). We likely need to fix the back-end to send the correct childMoneyRequestCount in Pusher update.

What alternative solutions did you explore? (Optional)

An alternate of 1. is we can include the parentReportActionID of the money request report in the transactions data returned by back-end (and in optimistic data when creating the transaction), this will make the change more straight-forward. But this will require back-end change.

@shubham1206agra
Copy link
Contributor

It seems that when the employee first created the scanning, the back-end will send Pusher updates which counts the "hidden" request into the childMoneyRequestCount of the report preview action. When refreshing however, the childMoneyRequestCount will be correct (not including the hidden report action). We likely need to fix the back-end to send the correct childMoneyRequestCount in Pusher update.

@mallenexpensify Can you get this internal to check Pusher if this is indeed the case? It might get fixed with BE only.

@tienifr
Copy link
Contributor

tienifr commented Mar 11, 2024

It might get fixed with BE only.

@shubham1206agra Unfortunately it won't, the part where it shows "1 request, 1 scanning" even though there's no scanning request in the IOU, only 2 manual requests, will still remain.

There're 2 parts for the problem:

  1. The number of scanning request needs to be correct
  2. The total number of requests (both scanning + other requests) needs to be correct.

The Pusher fix will fix 2, but not 1.

@shubham1206agra
Copy link
Contributor

Ok, then we can hold for BE changes first.
cc @mallenexpensify

@trjExpensify
Copy link
Contributor

We discussed this is channel, @mallenexpensify. Let's close it. Using "whispers" for scanning receipts is being removed.

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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants