Repository navigation
Prohibited expense violation shows multiple lines instead of grouping them - #73828
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
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.
|
Code Review Issues Found1. Critical Logic Error in mergeProhibitedViolations (src/hooks/useTransactionViolations.ts, line 11-23)Issue: The function always returns a merged prohibited violation object even when there are NO prohibited violations in the input. Problem Flow:
Impact: This will cause an empty Prohibited expense violation to always appear in the UI even when there are no prohibited expense violations. Suggested Fix: Add an early return when there are no prohibited violations to merge. 2. Missing Type Update in DebugUtils.ts (line 1278)Issue: The prohibitedExpenseRule type definition needs to be updated to match the new array type. Current: prohibitedExpenseRule: string 3. Empty Array Handling in Language FilesIssue: When there are no prohibited expenses (empty array), the violation message will display Prohibited expense with a trailing space. Suggested Fix: Add a check to handle empty arrays before joining. This change should be applied to all language files (de.ts, en.ts, es.ts, fr.ts, it.ts, ja.ts, nl.ts, pl.ts, pt-BR.ts, zh-hans.ts). |
Additional Issue Found4. Missing Unit TestsIssue: The PR checklist indicates that unit tests were added, but there are no test files in the changed files list. Recommendation: Add unit tests for the new mergeProhibitedViolations function, especially for:
Example test structure:
|
| if (Array.isArray(prohibitedExpenseTypes)) { | ||
| types = prohibitedExpenseTypes; | ||
| } else if (prohibitedExpenseTypes) { | ||
| types = [prohibitedExpenseTypes]; |
|
@paulnjs We also need to add a unit test based on the bot’s findings in the checklist. |
|
I will update it today |
|
I'm getting some errors during implementation. Will continue update it tmr |
|
I'm still having problems in some test cases. Will try to finish tmr |
|
Hey @suneox , I try to scan receipt above again but unable to receive 2 violations anymore. Can you help to check on your side or do you have any other receipt to reproduce this |
You can try using this recipe several times.
|
|
@paulnjs Please also fix the ESLint check |
|
@suneox Updated. Please help to check again. Thanks. |
|
@paulnjs The current code still doesn’t handle this case.
You can use this receipt for testing
|
|
@suneox Yah, I thought it is Inbox 😄. I will update it tmr |
JmillsExpensify
left a comment
There was a problem hiding this comment.
These changes look good from a product perspective.
|
@suneox I updated. Please help to check again on your side |
Reviewer Checklist
Screenshots/Videos |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/lakchote in version: 9.2.58-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.2.58-3 🚀
|
















Explanation of Change
Fixed Issues
$#72699
PROPOSAL:#72699 (comment)
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
MacOS: Desktop