Skip to content

[HOLD for payment 2024-11-14] [$250] Track distance - Distance and Rate show “Pending” when tracking via Just track it route #51679

Closed

Description

@lanitochka17

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: 9.0.55-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+kh1610015@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • Account has no expense
  1. Go to staging.new.expensify.com
  2. Go to Search
  3. Click Create expense
  4. Go to Distance
  5. Enter waypoints > Next
  6. Click Just track it

Expected Result:

Distance and Rate will show the correct distance and rate when tracking via Just track it route

Actual Result:

Distance and Rate show “Pending” when tracking via Just track it route

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence
Bug6649481_1730217378679.20241029_235412.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021851378732093417344
  • Upwork Job ID: 1851378732093417344
  • Last Price Increase: 2024-10-29
  • Automatic offers:
    • nkdengineer | Contributor | 104720899
Issue OwnerCurrent Issue Owner: @greg-schroeder

Activity

  1. added
    Daily
    Bug
    on Oct 29, 2024
  2. melvin-bot commented on Oct 29, 2024

    @melvin-bot

    Triggered auto assignment to @greg-schroeder (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.

  3. lanitochka17 commented on Oct 29, 2024

    @lanitochka17
    Author

    @greg-schroeder 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

  4. nkdengineer commented on Oct 29, 2024

    @nkdengineer
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-10-29 18:55:18 UTC.

    Proposal

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

    Distance and Rate show “Pending” when tracking via Just track it route

    What is the root cause of that problem?

    When we click on Just track it, we don't set the customUnitRateID as we do here

    IOU.setMoneyRequestParticipantsFromReport(transactionID, ReportUtils.getReport(selfDMReportID));

    Then the mileageRate in the confirmation page here is undefined based on this logic

    Which causes isDistanceRequestWithPendingRoute is true

    const isDistanceRequestWithPendingRoute = isDistanceRequest && (!hasRoute || !rate) && !isMovingTransactionFromTrackExpense;

    and waypoints pendingField is added as add which makes Pending... is displayed for distance and rate field

    useEffect(() => {
    if (!isDistanceRequest || isMovingTransactionFromTrackExpense) {
    return;
    }
    /*
    Set pending waypoints based on the route status. We should handle this dynamically to cover cases such as:
    When the user completes the initial steps of the IOU flow offline and then goes online on the confirmation page.
    In this scenario, the route will be fetched from the server, and the waypoints will no longer be pending.
    */
    IOU.setMoneyRequestPendingFields(transactionID, {waypoints: isDistanceRequestWithPendingRoute ? CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD : null});
    const distanceMerchant = DistanceRequestUtils.getDistanceMerchant(hasRoute, distance, unit, rate ?? 0, currency ?? CONST.CURRENCY.USD, translate, toLocaleDigit);
    IOU.setMoneyRequestMerchant(transactionID, distanceMerchant, true);
    }, [

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

    We should update the customUnitRateID when we click on Just track it button here. Optionally, we can only do it if the request is distance request.

    const rateID = DistanceRequestUtils.getCustomUnitRateID(selfDMReportID, !canUseP2PDistanceRequests);
    IOU.setCustomUnitRateID(transactionID, rateID);
    

    IOU.setMoneyRequestParticipantsFromReport(transactionID, ReportUtils.getReport(selfDMReportID));

    OPTIONAL: We can also update the reportID of the draft transaction to selfDMReportID

    What alternative solutions did you explore? (Optional)

    We can do this logic inside setMoneyRequestParticipantsFromReport function

  5. added
    External
    on Oct 29, 2024
  6. changed the title [-]Track distance - Distance and Rate show “Pending” when tracking via Just track it route[/-] [+][$250] Track distance - Distance and Rate show “Pending” when tracking via Just track it route[/+] on Oct 29, 2024
  7. melvin-bot commented on Oct 29, 2024

    @melvin-bot
  8. added
    Help Wanted
    on Oct 29, 2024
  9. melvin-bot commented on Oct 29, 2024

    @melvin-bot

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

  10. s77rt commented on Oct 30, 2024

    @s77rt
    Member

    @nkdengineer Thanks for the proposal. Your RCA makes sense. Do you know at what stage we set the comment.customUnit.customUnitRateID when using the FAB Track Expense option?

  11. nkdengineer commented on Oct 30, 2024

    @nkdengineer
    Contributor

    @s77rt When using FAB Track expense the customUnitRateID is updated here.

    App/src/libs/actions/IOU.ts

    Lines 352 to 354 in a4c8de6

    if (!isFromGlobalCreate) {
    const customUnitRateID = DistanceRequestUtils.getCustomUnitRateID(reportID);
    comment.customUnit = {customUnitRateID};

  12. s77rt commented on Oct 30, 2024

    @s77rt
    Member

    @nkdengineer Got it! Thanks! The proposed solution looks good to me.

    🎀 👀 🎀 C+ reviewed
    Link to proposal

  13. 16 remaining items

  14. changed the title [-][$250] Track distance - Distance and Rate show “Pending” when tracking via Just track it route[/-] [+][HOLD for payment 2024-11-14] [$250] Track distance - Distance and Rate show “Pending” when tracking via Just track it route[/+] on Nov 7, 2024
  15. removed
    Reviewing
    on Nov 7, 2024
  16. melvin-bot commented on Nov 7, 2024

    @melvin-bot

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

  17. melvin-bot commented on Nov 7, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.58-2 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-11-14. 🎊

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

  18. melvin-bot commented on Nov 7, 2024

    @melvin-bot

    @s77rt @greg-schroeder The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  19. s77rt commented on Nov 10, 2024

    @s77rt
    Member

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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: [A/B Testing - Create Expense] Implement Create Expense Flow under hidden Beta #49007 (comment)

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: n/a

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    • Account has no expenses

    Test:

    1. Go to Search > Expenses
    2. Click Create expense
    3. Choose Distance and select waypoints then click on Next
    4. Click Just track it
    5. Verify that all the fields display the correct values and none is "Pending"

    Do we agree 👍 or 👎

  20. greg-schroeder commented on Nov 11, 2024

    @greg-schroeder
    Contributor

    Thanks @s77rt! Looks like we're set to go for 11/14

  21. s77rt commented on Nov 11, 2024

    @s77rt
    Member

    @greg-schroeder I think you still need to create a GH issue for the testrail test

  22. greg-schroeder commented on Nov 12, 2024

    @greg-schroeder
    Contributor

    Yeah of course. I'll file it after I pay this on 11/14

  23. added
    Daily
    and removed
    Weekly
    on Nov 14, 2024
  24. greg-schroeder commented on Nov 15, 2024

    @greg-schroeder
    Contributor

    Payment summary:

    Contributor: @nkdengineer - $250 - Upwork
    C+: @s77rt - $250 - NewDot manual request

  25. JmillsExpensify commented on Nov 18, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @s77rt

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions