Skip to content

[HOLD for payment 2024-02-19] [$500] Distance - Receipt shows original amount and distance instead of TBD when editing distance offline #33362

Closed

Description

@kbecciv

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: v1.4.14-2
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:

Precondition: There is a distance expense request in the workspace chat.

  1. Navigate to the workspace chat from the precondition.
  2. Open the distance request details page.
  3. Click on the receipt.
  4. Close the receipt.
  5. Go offline.
  6. Click Distance.
  7. Add a stop and save it.
  8. Click on the receipt.

Expected Result:

The amount and distance will show TBD.

Actual Result:

The amount and distance are not showing TBD. The values are still showing the original value before edit.

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

Bug6321335_1703081373259.bandicam_2023-12-15_03-44-39-835.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d635e8deae97ab55
  • Upwork Job ID: 1737476292940328960
  • Last Price Increase: 2024-01-03
  • Automatic offers:
    • paultsimura | Contributor | 28089473
Issue OwnerCurrent Issue Owner: @kevinksullivan

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 20, 2023
  2. changed the title [-]Distance - Receipt shows original amount and distance instead of TBD when editing distance offline[/-] [+][$500] Distance - Receipt shows original amount and distance instead of TBD when editing distance offline[/+] on Dec 20, 2023
  3. melvin-bot commented on Dec 20, 2023

    @melvin-bot
  4. melvin-bot commented on Dec 20, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 20, 2023
  6. melvin-bot commented on Dec 20, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Dec 20, 2023

    @melvin-bot

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

  8. dukenv0307 commented on Dec 20, 2023

    @dukenv0307
    Contributor

    Proposal

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

    The amount and distance are not showing TBD. The values are still showing the original value before edit.

    What is the root cause of that problem?

    We don't use the same condition to show TDB as we do in MoneyRequestView. The same for merchant

    const formattedTransactionAmount = transactionAmount ? CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency) : translate('common.tbd');

    if (isDistanceRequest && (!formattedTransactionAmount || hasPendingWaypoints)) {
    formattedTransactionAmount = translate('common.tbd');
    }

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

    We should use the same condition to show the amount and merchant as we do in MoneyRequestView here

    const formattedTransactionAmount = transactionAmount ? CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency) : translate('common.tbd');

    if (isDistanceRequest && (!formattedTransactionAmount || hasPendingWaypoints)) {
    formattedTransactionAmount = translate('common.tbd');
    }

    What alternative solutions did you explore? (Optional)

    NA

  9. paultsimura commented on Dec 20, 2023

    @paultsimura
    Contributor

    Proposal

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

    Amount and Distance are not replaced with TBD in the eReceipt.

    What is the root cause of that problem?

    We currently show TBD only if the request has no initial amount:

    const formattedTransactionAmount = transactionAmount ? CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency) : translate('common.tbd');

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

    We should add a check for transaction.isLoading, and show TBD in this case as well:

    const formattedTransactionAmount = !transaction.isLoading && transactionAmount ? CurrencyUtils.convertToDisplayString(transactionAmount, transactionCurrency) : translate('common.tbd');
    const formattedMerchant = transaction.isLoading ? transactionMerchant.replace(CONST.REGEX.FIRST_SPACE, translate('common.tbd')) : transactionMerchant;

    And use this formattedMerchant instead of transactionMerchant here:

    <Text style={styles.eReceiptMerchant}>{transactionMerchant}</Text>

    What alternative solutions did you explore? (Optional)

    Instead of using transaction.isLoading, we can use the hasPendingWaypoints approach, but it was already discussed in a couple of places that we should move towards using transaction.isLoading instead of checking for pending waypoints, as it can be more dynamically controlled in one single place instead of later modifying the hasPendingWaypoints check in every single place where we use the TBD.

    This transaction.isLoading is being set in one single place when modifying the transaction, so it should be relied on as the source of truth for the distance transaction being in pending status:

    App/src/libs/actions/IOU.js

    Lines 936 to 946 in 249096e

    // Optimistically modify the transaction
    optimisticData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
    value: {
    ...updatedTransaction,
    pendingFields,
    isLoading: _.has(transactionChanges, 'waypoints'),
    errorFields: null,
    },
    });

  10. kevinksullivan commented on Dec 22, 2023

    @kevinksullivan
    Contributor

    Hi @parasharrajat please review the proposal!

  11. parasharrajat commented on Dec 22, 2023

    @parasharrajat
    Member

    Checking this in 2 hours.

  12. 46 remaining items

  13. melvin-bot commented on Feb 12, 2024

    @melvin-bot

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

  14. melvin-bot commented on Feb 12, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.39-8 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 2024-02-19. 🎊

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

  15. melvin-bot commented on Feb 12, 2024

    @melvin-bot

    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:

    • [@parasharrajat] The PR that introduced the bug has been identified. Link to the PR:
    • [@parasharrajat] 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:
    • [@parasharrajat] 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:
    • [@parasharrajat] Determine if we should create a regression test for this bug.
    • [@parasharrajat] 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.
    • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  16. melvin-bot commented on Feb 20, 2024

    @melvin-bot

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

  17. paultsimura commented on Feb 20, 2024

    @paultsimura
    Contributor

    False alert – I used this issue as a reference.

  18. parasharrajat commented on Feb 20, 2024

    @parasharrajat
    Member

    I think the issue is eligible for a bonus due to the scope change on the PR. @paultsimura did great job in handling and managing the discussion till the end.

  19. melvin-bot commented on Feb 21, 2024

    @melvin-bot

    @amyevans, @paultsimura, @kevinksullivan, @parasharrajat Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  20. kevinksullivan commented on Feb 22, 2024

    @kevinksullivan
    Contributor

    Payment summary:

  21. parasharrajat commented on May 13, 2024

    @parasharrajat
    Member

    Payment requested as per #33362 (comment)

  22. JmillsExpensify commented on May 19, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions