[No QA] Cleanup advanced filters code for a ton of filters#69800
[No QA] Cleanup advanced filters code for a ton of filters#69800justinpersaud merged 7 commits intomainfrom
Conversation
|
@justinpersaud 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] |
|
Adding carlos as a reviewer so he can track changes that were made when he gets back from OOO, but could you please review this @justinpersaud ? Thanks! |
Reviewer Checklist
Screenshots/VideosN/A |
|
Code clean up PR, doesn’t have any new product considerations. Removing the tag and unsubscribing myself. |
| if (AMOUNT_FILTER_KEYS.includes(filterName as SearchAmountFilterKeys)) { | ||
| if (typeof filterValue === 'string') { | ||
| const backendAmount = convertToBackendAmount(Number(filterValue)); | ||
| return Number.isNaN(backendAmount) ? filterValue : backendAmount.toString(); | ||
| } | ||
| return filterValue.map((amount) => { | ||
| const backendAmount = convertToBackendAmount(Number(amount)); | ||
| return Number.isNaN(backendAmount) ? amount : backendAmount.toString(); | ||
| }); |
There was a problem hiding this comment.
NAB: Potential issue, if users paste values with thousand separators (e.g., "1,234.56") or spaces, Number() becomes NaN and the value will skip conversion. If this is expected, ✅; otherwise, consider normalizing input (e.g., stripping commas/spaces) before conversion to better align with real-world user input.
Why it matters: If a user types “1,000”, it won’t match any results because it remains as “1,000” in the backend query (string), instead of converting to “100000” (number).
🧪 Test coverage - Consider unit tests for (if we decide to implement the logic mentioned above):
- Conversion of single and array amount values for each key in
AMOUNT_FILTER_KEYS - Ensuring non-numeric strings remain unchanged
- Verifying
buildFilterFormValuesFromQuerypicks up<and>operators and respectsIOU.AMOUNT_MAX_LENGTH+2
There was a problem hiding this comment.
This is the same logic from before, just using AMOUNT_FILTER_KEYS, so lets keep it the same for now, if this is a bug that exists on prod, could you create a bug report for it?
|
🎯 @ikevin127, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #69832. |
|
@Gonals I assigned carlos so he can track progress when hes back from OOO, would you mind reviewing this? Thanks! |
…p-advanced-filters-code
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
Oh, melvin assigned two people, sorry Alberto, thanks Justin! |
|
🚀 Deployed to staging by https://github.com/justinpersaud in version: 9.2.2-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.2.2-8 🚀
|
Explanation of Change
No feature changes, code cleanup of advanced filters to better reuse methods, match existing patterns, and make adding new filters easier
Fixed Issues
N/A
Tests
N/A
Offline tests
N/A
QA Steps
N/A
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)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
N/A