Repository navigation
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
@MelvinBot I don't really like the solution in MoneyRequestView. I think we should fix DistanceRequestUtils.getRate, and then also probably getMerchant. Ideally the fixes happen in some util functions so they apply everywhere we display a rate without having to change all display sites. |
|
Thanks for the feedback @neil-marcellini — I agree the fix should live in the util layer rather than at the display site. Here's my analysis of what that would look like: The Core Problem
Recommended Approach1. Fix
|
|
Yes pls implement it. Not sure if I need to tag you or not... |
|
Ok yeah I do need to tag. Yes @MelvinBot pls implement that. |
|
@neil-marcellini I've pushed the changes to move the fix into the util layer. Here's a summary of what changed: Changes
Why
|
|
Fixed the failing Prettier check — the nullish coalescing expression The typecheck failure was a transient CI infrastructure issue ( |
|
All checks are now passing. ✅ The previous failures were in TypeScript Checks and Prettier check (run |
|
Fixed the failing checks. All failures (typecheck, all 7 test shards, and Storybook tests) were caused by two issues:
|
|
The failing checks from the previous push were:
Both PR-related issues were already fixed in commit |
Move getRateFromMerchant from MergeTransactionUtils to DistanceRequestUtils. Add getStoredRateForDisplay that extracts rate from stored merchant string before falling back to policy rate computation. Update TransactionUtils.getMerchant to prefer stored merchant with rate info over recalculating from policy. This prevents policy rate changes from retroactively altering historical distance expense display values. Co-authored-by: Neil Marcellini <neil-marcellini@users.noreply.github.com>
412f196 to
03bfa28
Compare
|
Fixed the failing Root cause: The Fix: Recreated the branch properly on top of current |
|
Never mind, closing and going with a different approach for now as explained here. |
Explanation of Change
When a workspace admin changes a distance rate, all historical distance expenses retroactively display the new rate — even those on Approved and Exported reports. This happens because
getRate()always resolves the rate from the current policy state, andgetMerchant()dynamically recalculates the merchant string from that rate.However, the original rate is already preserved in the stored merchant string on the transaction (e.g.,
10.00 mi @ $0.70 / mi). This PR makes two changes to prefer the stored merchant data over dynamically recalculating from the policy:getMerchant()inTransactionUtils: For distance requests where the stored merchant contains rate info (has the@separator), return it directly instead of recalculating from the current policy rate.MoneyRequestView.tsx: For distance requests, extract the rate display string from the stored merchant using the existinggetRateFromMerchant()utility (already used for merge transactions), and prefer it over the policy-derived rate.This is a display-layer fix that preserves historical rates for existing transactions. A future backend change will store the rate value in
transaction.comment.customUnit.ratefor proper long-term support.Fixed Issues
$ #82123
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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