You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250][P2P Distance] - Distance unit in the system message changes from "miles" to "mi" after changing rate #46873
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
Issue found when validating #40021 Version Number: 9.0.17-0 Reproducible in staging?: y Reproducible in production?: n 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:
Workspace has a few distance rates.
Go to staging.new.expensify.com
Go to workspace chat.
Submit a distance expense.
Go to transaction thread.
Click Rate.
Select a different rate.
Expected Result:
The distance unit in the system message will remain the same after changing the rate.
Actual Result:
The distance unit in the system message changes from "miles" to "mi" after changing distance rate.
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
But we don't need mi/km in miles/kilometers format when using getDistanceMerchant in calculateAmountForUpdatedWaypointOrRate util function because the backend returns the unit in mi/km form.
What changes do you think we should make in order to solve the problem?
We should update the getDistanceMerchant function to accept a new param shouldUseShortFormForUnit.
Then update getDistanceForDisplay and getRateForDisplay to accept a new param shouldUseShortFormForUnit.
In getDistanceForDisplay and getRateForDisplay, if shouldUseShortFormForUnit is true we will simply use the unit as it is instead of using the translation.
In calculateAmountForUpdatedWaypointOrRate pass shouldUseShortFormForUnit as true to DistanceRequestUtils.getDistanceMerchant.
What alternative solutions did you explore? (Optional)
The PR that introduced the bug has been identified. Link to the PR:No specific PR introduced this – the discrepancy between optimistic and server-side mileage units has been present from the beginning of the Distance implementation. This was just a cleanup.
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: N/A
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: N/A
Determine if we should create a regression test for this bug: Yes
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.
Regression Test Proposal
Pre-requisite: have a workspace with multiple distance rates.
Go to a workspace chat.
Submit a distance expense.
Go to the transaction thread.
Go offline
Click "Rate"
Select a different rate.
Verify the distance unit in the system message uses the short version: "mi" or "km" after changing the distance rate.
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review
Activity
melvin-bot commentedon Aug 6, 2024
Triggered auto assignment to @muttmuure (
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 commentedon Aug 6, 2024
Triggered auto assignment to @puneetlath (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.github-actions commentedon Aug 6, 2024
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Krishna2323 commentedon Aug 6, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Distance- Distance unit in the system message changes from "miles" to "mi" after changing rate
What is the root cause of that problem?
calculateAmountForUpdatedWaypointOrRatewe are usinggetDistanceMerchantwhich usesgetDistanceForDisplay&getRateForDisplay.App/src/libs/TransactionUtils/index.ts
Lines 777 to 779 in 984fd39
getDistanceForDisplay&getRateForDisplayuses translations formi/km.App/src/libs/DistanceRequestUtils.ts
Lines 170 to 174 in 984fd39
App/src/libs/DistanceRequestUtils.ts
Lines 148 to 153 in 984fd39
mi/kminmiles/kilometersformat when usinggetDistanceMerchantincalculateAmountForUpdatedWaypointOrRateutil function because the backend returns the unit inmi/kmform.What changes do you think we should make in order to solve the problem?
getDistanceMerchantfunction to accept a new paramshouldUseShortFormForUnit.getDistanceForDisplayandgetRateForDisplayto accept a new paramshouldUseShortFormForUnit.getDistanceForDisplayandgetRateForDisplay, ifshouldUseShortFormForUnitis true we will simply use the unit as it is instead of using the translation.calculateAmountForUpdatedWaypointOrRatepassshouldUseShortFormForUnitas true toDistanceRequestUtils.getDistanceMerchant.What alternative solutions did you explore? (Optional)
34 remaining items
Krishna2323 commentedon Aug 20, 2024
@paultsimura, PR ready for review ^
paultsimura commentedon Aug 30, 2024
Deployed to prod #47605 (comment)
Payment is due 06.09.2024
paultsimura commentedon Sep 5, 2024
The PR that introduced the bug has been identified. Link to the PR:No specific PR introduced this – the discrepancy between optimistic and server-side mileage units has been present from the beginning of the Distance implementation. This was just a cleanup.Regression Test Proposal
Pre-requisite: have a workspace with multiple distance rates.
Do we agree 👍 or 👎
paultsimura commentedon Sep 5, 2024
FYI @muttmuure – the payment is due tomorrow.
Krishna2323 commentedon Sep 9, 2024
@muttmuure, friendly bump for payments 🙏🏻
paultsimura commentedon Sep 9, 2024
@Krishna2323 I pinged in Slack, should be completed today.
muttmuure commentedon Sep 9, 2024
$250 - @paultsimura
$250 - @Krishna2323
muttmuure commentedon Sep 9, 2024
Paid