App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Manual distance - Rate field on confirm page shows default rate instead of last selected rate

Open nlemma opened this issue 3 months ago β€’ 27 comments

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: 9.2.20-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1030/folder/13176744/41237166/924222990 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Device used: Mac 15.5 / Chrome App Component: Money Requests

Action Performed:

Precondition:

  • Create two workspaces - Workspace A and Workspace B.
  • Each workspace has two distance rates - 0.70 / mile and 1.00 / mile
  1. Go to staging.new.expensify.com

  2. Go to workspace chat A.

  3. Click + > Track distance > Map.

  4. Create a Map distance expense with 1.00 / mile rate.

  5. Click + > Track distance > Map.

  6. Enter waypoints > Next. β†’ On confirm page, Rate field shows the last selected rate (1.00 / mile), which is expected.

  7. Go to workspace chat B.

  8. Click + > Track distance > Manual.

  9. Create a Manual distance expense with 1.00 / mile rate.

  10. Click + > Track distance > Manual.

  11. Enter distance > Next. β†’ On confirm page, Rate field shows the the default rate (0.70 / mile) instead of the last selected rate (1.00 / mile), which is inconsistent with Step 6 where Map distance is created and Rate field shows the last selected rate (1.00 / mile).

Expected Result:

In Step 11, Rate field will show the last selected rate, which is 1.00 / mile.

Actual Result:

In Step 11, Rate field shows the the default rate (0.70 / mile) instead of the last selected rate (1.00 / mile).

This is inconsistent with Step 6 where Map distance is created and Rate field shows the last selected rate (1.00 / mile).

Workaround:

Unknown

Platforms:

  • [x] Android: App
  • [x] Android: mWeb Chrome
  • [x] iOS: App
  • [x] iOS: mWeb Safari
  • [x] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome / Safari
  • [x] MacOS: Desktop

Screenshots/Videos

https://github.com/user-attachments/assets/569dcff0-8c4a-454c-baaa-4ebb48761553

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021973662938595570701
  • Upwork Job ID: 1973662938595570701
  • Last Price Increase: 2025-12-25
Issue OwnerCurrent Issue Owner: @akinwale

nlemma avatar Sep 30 '25 11:09 nlemma

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

melvin-bot[bot] avatar Sep 30 '25 11:09 melvin-bot[bot]

Proposal

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

Manual distance - Rate field on confirm page shows default rate instead of last selected rate

What is the root cause of that problem?

CUrrently we are using ||, which treated a missing rate (undefined) the same as falsy values and always fell back to the default, even when a valid customUnitRateID was set.

https://github.com/Expensify/App/blob/bda97bb1fb50e3ff24c9f6c79dd715842c46b335/src/libs/DistanceRequestUtils.ts#L363-L366

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

We should use ??, so that we fall back when the rate is truly null or undefined, so the previously selected rate is preserved instead of being replaced with the default.

const transactionRate = customUnitRateID ? mileageRates?.[customUnitRateID] : undefined;
const customMileageRate = transactionRate ?? defaultMileageRate;

here

https://github.com/Expensify/App/blob/bda97bb1fb50e3ff24c9f6c79dd715842c46b335/src/libs/DistanceRequestUtils.ts#L363-L366

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

samranahm avatar Sep 30 '25 13:09 samranahm

BE return wrong customUnitRateID for Manual track distance and that id's rate match with defaultMileageRate causing this bug.

samranahm avatar Sep 30 '25 13:09 samranahm

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

melvin-bot[bot] avatar Oct 02 '25 08:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 02 '25 08:10 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Oct 09 '25 16:10 melvin-bot[bot]

@akinwale 10 days overdue. I'm getting more depressed than Marvin.

melvin-bot[bot] avatar Oct 13 '25 17:10 melvin-bot[bot]

@akinwale 10 days overdue. I'm getting more depressed than Marvin.

melvin-bot[bot] avatar Oct 13 '25 23:10 melvin-bot[bot]

@akinwale 12 days overdue. Walking. Toward. The. Light...

melvin-bot[bot] avatar Oct 15 '25 11:10 melvin-bot[bot]

@dylanexpensify This is a bug that needs to be fixed in the backend.

akinwale avatar Oct 16 '25 05:10 akinwale

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Oct 16 '25 16:10 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Oct 23 '25 16:10 melvin-bot[bot]

@akinwale 10 days overdue. Is anyone even seeing these? Hello?

melvin-bot[bot] avatar Oct 27 '25 23:10 melvin-bot[bot]

@akinwale @dylanexpensify this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Oct 28 '25 21:10 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Oct 30 '25 16:10 melvin-bot[bot]

This issue has not been updated in over 14 days. @akinwale, @dylanexpensify eroding to Weekly issue.

melvin-bot[bot] avatar Nov 03 '25 23:11 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 06 '25 16:11 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 13 '25 16:11 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 20 '25 16:11 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 27 '25 16:11 melvin-bot[bot]

This issue has not been updated in over 15 days. @akinwale, @dylanexpensify eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

melvin-bot[bot] avatar Nov 28 '25 01:11 melvin-bot[bot]

Issue not reproducible during KI retests. (First week)

mvtglobally avatar Nov 30 '25 07:11 mvtglobally

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 04 '25 16:12 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 11 '25 16:12 melvin-bot[bot]

Issue not reproducible during KI retests. (Second week)

mvtglobally avatar Dec 13 '25 03:12 mvtglobally

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 18 '25 16:12 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 25 '25 16:12 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Jan 01 '26 16:01 melvin-bot[bot]

Issue not reproducible during KI retests. (Third week)

mvtglobally avatar Jan 03 '26 02:01 mvtglobally