Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ function PolicyCommuterExclusionsPage({route}: PolicyCommuterExclusionsPageProps
return;
}

if (existingMethod === CONST.POLICY.COMMUTER_EXCLUSION_METHOD.FIXED_DISTANCE && existingCommuterExclusions?.fixedDistance === numeric) {
const isSameDistance = existingMethod === CONST.POLICY.COMMUTER_EXCLUSION_METHOD.FIXED_DISTANCE && existingCommuterExclusions?.fixedDistance === numeric;
const isSameUnit = existingCommuterExclusions?.fixedDistanceUnit === workspaceUnit;
if (isSameDistance && isSameUnit) {
Comment on lines +99 to +101

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gonals I think this will not fix the bug: Unit is Km but exclude commuter mention Mi

Image

The problem is within this line which uses policy.commuterExclusions.fixedDistanceUnit not the defaultUnit

unit: policy.commuterExclusions.fixedDistanceUnit ?? defaultUnit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES,

It seems we need to update SetPolicyDistanceRatesUnit command on the backend side to update the commuter rate unit saved on the policy object, which is not the case right now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. I was thinking we could leave it with the unit it was setup. That's why we save the unit. Even if the default unit has changed, we can still calculate the exclusion with the saved unit later

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense. I would expect it to change automatically. We can definitely leave it as it is for the time being.

goBackToSettings();
return;
}
Expand Down
Loading