-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown distance rate shown during track expense that cause an error #56343
Comments
Triggered auto assignment to @joekaufmanexpensify ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Unknown distance rate shown during track expense that cause an error What is the root cause of that problem?When we do not have any workspace, then we categorize it, it will redirect us to workspace upgrade step which will workspace for us App/src/pages/ReportDetailsPage.tsx Lines 473 to 479 in 27780d5
Lines 8782 to 8784 in 27780d5
App/src/pages/iou/request/step/IOURequestStepUpgrade.tsx Lines 67 to 70 in 27780d5
And inside the createWorkspace function we will create the workspace using the default rates using buildOptimisticDistanceRateCustomUnits function which cause this error because the generated rate doesn't existhttps://github.com/Expensify/App/blob/27780d5a3c15ce3141d6ed3035cb4ed218f8f265/src/libs/actions/Policy/Policy.ts#L2037-L2047C64 App/src/libs/actions/Policy/Policy.ts Lines 1726 to 1739 in 27780d5
What changes do you think we should make in order to solve the problem?When creating the workspace we need to pass new param i.e transactionID (for the transaction draft id), and when creating the custom distance rate for the policy data we can use the function buildOptimisticDistanceRateCustomUnits(reportCurrency?: string, transactionID?: string): OptimisticCustomUnits {
const currency = reportCurrency || (allPersonalDetails?.[sessionAccountID]?.localCurrencyCode ?? CONST.CURRENCY.USD);
const transaction = getTransaction(transactionID);
const distanceRate = DistanceRequestUtils.getRateForP2P(currency, transaction)
const customUnitID = generateCustomUnitID();
const customUnitRateID = generateCustomUnitID();
const customUnits: Record<string, CustomUnit> = {
[customUnitID]: {
customUnitID,
name: CONST.CUSTOM_UNITS.NAME_DISTANCE,
attributes: {
unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES,
},
rates: {
[customUnitRateID]: {
customUnitRateID,
name: CONST.CUSTOM_UNITS.DEFAULT_RATE,
rate: distanceRate.rate, The full code can be found in this test branch And we need BE changes and pass custom distance rates What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?N/A UI bug What alternative solutions did you explore? (Optional)After creating the workspace, we can check if the policy custom distance rate is different from the transaction.comments.customUnits distance rate, then we will change the policy distance rate by calling UpdatePolicyDistanceRateValue function |
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: v9.0.94-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #56146
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Windows 10 / Chrome, Samsung s10/ Chrome, Samsung s10/ Android 12
App Component: Other
Action Performed:
Expected Result:
The generated rate should on the list of rates if it is a default rate and will not cause any error during track expense flow.
Actual Result:
There is unknown generated rate for distance track expense that cause an error
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6733167_1738675108763.bandicam_2025-02-04_15-16-46-898.mp4
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: