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 2023-10-30] [$500] IOU - "TBD" is missing in the IOU details of the "Amount" field in offline mode #29553

Closed
6 tasks done
lanitochka17 opened this issue Oct 13, 2023 · 23 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 Oct 13, 2023

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.3.83-1

Reproducible in staging?: Yes

Reproducible in production?: Yes

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 New Expensify app
  2. Sign in HT account
  3. Go offline
  4. Click on the FAB button
  5. Click on 'Request Money'
  6. Choose 'Distance'
  7. Add a route from point 1 to point 2
  1. 123 W Main St, Independence, KS 67301, USA
  2. 321 Westminster Pl, Independence, KS 67301, USA
  1. Click on the "Next" button
  2. Select any WS
  3. Complete the IOU
  4. Navigate to the details of the created IOU

Expected Result:

In cases of creating Distance Expense offline, the text "TBD" must be present in the "Amount" field until you go online and update the amount

Actual Result:

In cases where Distance Expense are created offline, the "Amount" field in the IOU details is missing "TBD" and the user is prompted to enter the data manually

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Bug6235636_1697188793732.Recording__521.mp4
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019934d58cfa56e1ed
  • Upwork Job ID: 1712816402772860928
  • Last Price Increase: 2023-10-13
  • Automatic offers:
    • paultsimura | Contributor | 27256874
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

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

@laurenreidexpensify laurenreidexpensify added the External Added to denote the issue can be worked on by a contributor label Oct 13, 2023
@melvin-bot melvin-bot bot changed the title IOU - "TBD" is missing in the IOU details of the "Amount" field in offline mode [$500] IOU - "TBD" is missing in the IOU details of the "Amount" field in offline mode Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 13, 2023

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

@paultsimura
Copy link
Contributor

paultsimura commented Oct 13, 2023

Proposal

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

When a Distance Request is created offline, the amount of the report preview shows 0.00 instead of "TBD"

What is the root cause of that problem?

For the Report Preview, we calculate the displayed amount here:

const getDisplayAmount = () => {
if (reportTotal) {
return CurrencyUtils.convertToDisplayString(reportTotal, props.iouReport.currency);
}
if (isScanning) {
return props.translate('iou.receiptScanning');
}
// If iouReport is not available, get amount from the action message (Ex: "Domain20821's Workspace owes $33.00" or "paid ₫60" or "paid -₫60 elsewhere")
let displayAmount = '';
const actionMessage = lodashGet(props.action, ['message', 0, 'text'], '');
const splits = actionMessage.split(' ');
for (let i = 0; i < splits.length; i++) {
if (/\d/.test(splits[i])) {
displayAmount = splits[i];
}
}
return displayAmount;
};

However, we do not check if the Report consists only of the distance requests. So if it's only pending distance requests, the amount is set to the default 0.00

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

In ReportUtils, add a function similar to the existing getTransactionsWithReceipts:

function getDistanceRequestTransactions(iouReportID) {
    const allTransactions = TransactionUtils.getAllReportTransactions(iouReportID);
    return _.filter(allTransactions, (transaction) => TransactionUtils.isDistanceRequest(transaction));
}

In ReportPreview, add a variable:

const hasOnlyDistanceRequests = numberOfRequests === _.size(ReportUtils.getDistanceRequestTransactions(props.iouReportID));

And add one more early return in the getDisplayAmount:

    const getDisplayAmount = () => {
        if (reportTotal) {
            return CurrencyUtils.convertToDisplayString(reportTotal, props.iouReport.currency);
        }
        if (isScanning) {
            return props.translate('iou.receiptScanning');
        }
+       if (hasOnlyDistanceRequests) {
+           return props.translate('common.tbd');
+       }

        ...

This will ensure the following:

  1. If we have at least one request with a valid amount inside the IOU Report, we will return the amount in the if (reportTotal) branch.
  2. If not and hasOnlyDistanceRequests === true – this means the report consists only of pending Distance requests, and we should display "TBD"

Result demonstrating a report with only one pending distance request, and a combination of a pending and loaded one:

Screen.Recording.2023-10-13.at.15.17.56.mov

What alternative solutions did you explore? (Optional)

We can also modify the subtitle to show not only ${count} requests, ${scanningReceipts} scanning, but something like:
${count} requests, ${X} scanning, ${Y} pending distance – the copy needs to be verified, obviously.

@paultsimura
Copy link
Contributor

paultsimura commented Oct 13, 2023

This issue was partially fixed by merging this pr: #27204
However, it fixed only the MoneyRequestPreview. So I've added a proposal to display TBD for ReportPreview as well.

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@laurenreidexpensify
Copy link
Contributor

@mananjadhav what do you think of the proposal above?

@melvin-bot melvin-bot bot removed the Overdue label Oct 16, 2023
@laurenreidexpensify
Copy link
Contributor

@mananjadhav bump ^^

@mananjadhav
Copy link
Collaborator

Sorry I was OOO yesterday. @paultsimura's proposal will work here.

🎀 👀 🎀 C+ reviewed.

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

📣 @mananjadhav Please request via NewDot manual requests for the Reviewer role ($500)

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

📣 @paultsimura 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@paultsimura
Copy link
Contributor

paultsimura commented Oct 18, 2023

Hey @Julesssss @neil-marcellini, how far do we want to go with displaying the "TBD" on the offline Distance Requests?
After digging a bit deeper on this issue, I've added TBD in a couple of other places (marked on screenshots).
Are these ok?

image

image

Which, when coming online, will transform into:

image image

@paultsimura
Copy link
Contributor

The PR is ready for review: #29892

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

🎯 ⚡️ Woah @mananjadhav / @paultsimura, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @paultsimura got assigned: 2023-10-18 10:31:31 Z
  • when the PR got merged: 2023-10-20 09:46:25 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 23, 2023
@melvin-bot melvin-bot bot changed the title [$500] IOU - "TBD" is missing in the IOU details of the "Amount" field in offline mode [HOLD for payment 2023-10-30] [$500] IOU - "TBD" is missing in the IOU details of the "Amount" field in offline mode Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.88-11 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 2023-10-30. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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:

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 29, 2023
@laurenreidexpensify
Copy link
Contributor

Payment Summary:

  • External issue reporter - N/A Applause
  • Contributor that fixed the issue - $500 + $250 - @paultsimura payment issued in Upwork
  • Contributor+ that helped on the issue and/or PR - $500 + $250 - @mananjadhav please submit a manual request in New Expensify

@laurenreidexpensify
Copy link
Contributor

@mananjadhav bump for checklist to close thanks

@mananjadhav
Copy link
Collaborator

@Julesssss I am unable to track at which point should we have done the offline handling. I can see multiple PRs contributed to the Display amount handling, but none have any logic related to distance requests. Should this have been handled during the Distance requests flow?

Nevertheless I feel it is easy to miss out the offline flow and hence it makes sense to add a regression test.

@laurenreidexpensify @Julesssss Regression Test Proposal:

  1. Open the app
  2. Ensure that you have a workspace where you don't have any pending IOU. Create one if that doesn't exist.
  3. Go offline
  4. Click on the FAB (+) button -> 'Request Money' -> 'Distance'
  5. Add the start and finish stops. and click on Next.
  6. Choose the workspace from step2, and finish the request money flow.
  7. Verify the IOU Report Preview shows TBD in place of the amount.
  8. Click on the IOU Report and verify that the total amount is set to TBD
  9. Verify that in the report name, the amount is displayed as TBD
  10. Click on the Distance report.
  11. Verify that in the transaction report name, the amount is displayed as TBD.
  12. Go online and confirm that all the TBDs are replaced with the actual amount.

@Julesssss
Copy link
Contributor

Thanks, yeah I agree this was introduced over many issues. 👍

@JmillsExpensify
Copy link

JmillsExpensify commented Nov 3, 2023

$750 payment approved for @mananjadhav based on BZ summary above.

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

No branches or pull requests

6 participants