fix: show disabled distance rate if it is selected in IOU request#47850
fix: show disabled distance rate if it is selected in IOU request#47850iwiznia merged 1 commit intoExpensify:mainfrom
Conversation
|
@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Will review this by tomorrow. |
|
|
||
| const currentRateID = TransactionUtils.getRateID(transaction) ?? '-1'; | ||
|
|
||
| const rates = DistanceRequestUtils.getMileageRates(policy, false, currentRateID); |
There was a problem hiding this comment.
I don't see the change to remove the Onyx keys. Is it already removed in another PR/refactor?
|
Code change is okay. Will work on the checklist. |
Reviewer Checklist
Screenshots/Videos |
|
I also tested a scenario where we have multiple disabled rates:
|
|
quick bump @iwiznia |
|
|
||
| Object.entries(distanceUnit.rates).forEach(([rateID, rate]) => { | ||
| if (!includeDisabledRates && rate.enabled === false) { | ||
| if (!includeDisabledRates && rate.enabled === false && (!selectedRateID || rateID !== selectedRateID)) { |
There was a problem hiding this comment.
!selectedRateID would fail if we have a rateID that's "0" no?
There was a problem hiding this comment.
If selectedRateID = "0" this condition !selectedRateID will be false (which is expected), no?
There was a problem hiding this comment.
No, "0" would be the ID, which means it has an ID
There was a problem hiding this comment.
No, "0" would be the ID, which means it has an ID
Sorry, I don't quite follow what you mean by '0' being the ID. Could you clarify that for me?
There was a problem hiding this comment.
If I create a rate whose ID is the string "0" then select it, this would not work because !"0" is false but that's wrong because we indeed passed an ID, so we should've compared selectedRateID with rateID but we did not
There was a problem hiding this comment.
so we should've compared selectedRateID with rateID but we did not
- No. I think with the current condition:
if (!includeDisabledRates && rate.enabled === false && (!selectedRateID || rateID !== selectedRateID)) {
we still compare selectedRateID with rateID via rateID !== selectedRateID.
CMIIWW. Thanks
There was a problem hiding this comment.
Oh, you are right! I was confusing the behavior with PHP where "0" is falsy
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |






Details
Fixed Issues
$ #46884
PROPOSAL: #46884 (comment)
Tests
Precondition:
Workspace has some distance rates.
2. Go to NewDot app
3. Go to workspace chat.
4. Submit a distance expense with Distance rate A.
5. Go to workspace settings > Distance rates.
6. Disable Distance rate A used in Step 3.
7. Go back to transaction thread of the distance expense.
8. Click Rate.
Verify that: The disabled rate will appear selected in the Rate list but grayed out (like Category and Tag when selected and disabled afterward).
Offline tests
QA Steps
Precondition:
Workspace has some distance rates.
2. Go to NewDot app
3. Go to workspace chat.
4. Submit a distance expense with Distance rate A.
5. Go to workspace settings > Distance rates.
6. Disable Distance rate A used in Step 3.
7. Go back to transaction thread of the distance expense.
8. Click Rate.
Verify that: The disabled rate will appear selected in the Rate list but grayed out (like Category and Tag when selected and disabled afterward).
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop