Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.55k stars 2.9k forks source link

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

Open lanitochka17 opened 2 weeks ago

lanitochka17 commented 2 weeks ago

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:

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?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/f4863806-3bb4-4f3f-873f-fba14a49508c

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
melvin-bot[bot] commented 2 weeks ago

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.

lanitochka17 commented 2 weeks ago

@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

nkdengineer commented 2 weeks ago

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

https://github.com/Expensify/App/blob/9f92c5e7850301b3b04efe80814a4790188fdde5/src/pages/iou/request/step/IOURequestStepParticipants.tsx#L164

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

Which causes isDistanceRequestWithPendingRoute is true

https://github.com/Expensify/App/blob/9f92c5e7850301b3b04efe80814a4790188fdde5/src/components/MoneyRequestConfirmationList.tsx#L290

and waypoints pendingField is added as add which makes Pending... is displayed for distance and rate field https://github.com/Expensify/App/blob/9f92c5e7850301b3b04efe80814a4790188fdde5/src/components/MoneyRequestConfirmationList.tsx#L664-L678

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);

https://github.com/Expensify/App/blob/9f92c5e7850301b3b04efe80814a4790188fdde5/src/pages/iou/request/step/IOURequestStepParticipants.tsx#L164

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

melvin-bot[bot] commented 2 weeks ago

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

melvin-bot[bot] commented 2 weeks ago

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

s77rt commented 2 weeks ago

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

nkdengineer commented 2 weeks ago

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

https://github.com/Expensify/App/blob/a4c8de60b4cdcd99aad0089ce73c339afa5d94f9/src/libs/actions/IOU.ts#L352-L354

s77rt commented 2 weeks ago

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

🎀 👀 🎀 C+ reviewed Link to proposal

melvin-bot[bot] commented 2 weeks ago

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

nkdengineer commented 1 week ago

@robertjchen Please take a look when you have a chance.

robertjchen commented 1 week ago

👍 to proposal!

melvin-bot[bot] commented 1 week ago

📣 @nkdengineer 🎉 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 📖

melvin-bot[bot] commented 1 week ago

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

melvin-bot[bot] commented 1 week ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.58-2 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-11-14. :confetti_ball:

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

melvin-bot[bot] commented 1 week ago

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

s77rt commented 4 days ago

BugZero Checklist:

Bug classification Source of bug: - [ ] 1a. Result of the original design (eg. a case wasn't considered) - [X] 1b. Mistake during implementation - [ ] 1c. Backend bug - [ ] 1z. Other: Where bug was reported: - [X] 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 - [X] 3d. QA - [ ] 3z. Other:
Regression Test Proposal Template

Regression Test Proposal

Precondition:

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 👎

greg-schroeder commented 3 days ago

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

s77rt commented 3 days ago

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

greg-schroeder commented 3 days ago

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