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] Web - IOU - TBD shows up for preview component after uploading picture as receipt and deleting it #33935

Closed
1 of 6 tasks
kbecciv opened this issue Jan 4, 2024 · 8 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

@kbecciv
Copy link

kbecciv commented Jan 4, 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.21-1
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. Open a conversation
  2. Click on plus icon inside composer
  3. Click on request money > Scan receipt
  4. Upload a picture which is not a receipt
  5. Finish the IOU flow and wait for the scan to finish
  6. After the scan finished and an error shows up go inside the IOU details page and delete the request
  7. Go back to the report

Expected Result:

TBD should not show as the preview component for the iou

Actual Result:

The IOU preview component turns to TBD

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

Bug6331902_1704349549835.tbd.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c149adeb2e7da69f
  • Upwork Job ID: 1742846560571473920
  • Last Price Increase: 2024-01-04
@kbecciv kbecciv 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 4, 2024
Copy link

melvin-bot bot commented Jan 4, 2024

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

@melvin-bot melvin-bot bot changed the title Web - IOU - TBD shows up for preview component after uploading picture as receipt and deleting it [$500] Web - IOU - TBD shows up for preview component after uploading picture as receipt and deleting it Jan 4, 2024
Copy link

melvin-bot bot commented Jan 4, 2024

Triggered auto assignment to @NicMendonca (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 4, 2024
Copy link

melvin-bot bot commented Jan 4, 2024

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

Copy link

melvin-bot bot commented Jan 4, 2024

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

@paultsimura
Copy link
Contributor

paultsimura commented Jan 4, 2024

Proposal

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

When the IOU Report contains only removed requests, the total is shown as TBD.

What is the root cause of that problem?

When calculating whether to show TBD on the IOU Report view, we use the hasOnlyDistanceRequestTransactions function. It returns true if the transactions list is empty, which is incorrect:

App/src/libs/ReportUtils.ts

Lines 980 to 987 in 3b424bb

/**
* Checks whether all the transactions linked to the IOU report are of the Distance Request type
*
*/
function hasOnlyDistanceRequestTransactions(iouReportID: string | undefined): boolean {
const transactions = TransactionUtils.getAllReportTransactions(iouReportID);
return transactions.every((transaction) => TransactionUtils.isDistanceRequest(transaction));
}

const formattedTotalAmount = CurrencyUtils.convertToDisplayString(totalDisplaySpend, report.currency, ReportUtils.hasOnlyDistanceRequestTransactions(report.reportID));

function convertToDisplayString(amountInCents = 0, currency: string = CONST.CURRENCY.USD, shouldFallbackToTbd = false): string {
if (shouldFallbackToTbd && !amountInCents) {
return Localize.translateLocal('common.tbd');
}

In our case, the transactions list is empty because when removing a failed scan request, we remove the transactions, but not the transaction threads (since they contain in-thread message from __fake__ (or notifications) account about the failed scan).

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

Modify the hasOnlyDistanceRequestTransactions function to return false if there are no transactions (it was broken during the TS migration):

return !!transactions.length && transactions.every((transaction) => TransactionUtils.isDistanceRequest(transaction));

Result:

image

What alternative solutions did you explore? (Optional)

@rojiphil
Copy link
Contributor

rojiphil commented Jan 4, 2024

This issue is been addressed in this PR
We can either put this on hold or close this
cc @fedirjh

@fedirjh
Copy link
Contributor

fedirjh commented Jan 4, 2024

Agree with @rojiphil , this should be fixed with #32698.

@NicMendonca
Copy link
Contributor

thanks both! closing for now

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
None yet
Development

No branches or pull requests

6 participants