-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: send split lineitem in payload #1096
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe changes involve modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
src/app/core/models/xero/xero-configuration/xero-export-settings.model.ts (1)
Line range hint
231-231
: Consider adding error handling for invalid splitExpenseGrouping valuesWhile the default value handling is correct, consider adding validation to ensure the value is always one of the valid SplitExpenseGrouping enum values. This would prevent potential runtime issues if invalid values somehow make it to this point.
Here's a suggested improvement:
- split_expense_grouping: exportSettingsForm.get('splitExpenseGrouping')?.value ? exportSettingsForm.get('splitExpenseGrouping')?.value : SplitExpenseGrouping.MULTIPLE_LINE_ITEM + split_expense_grouping: Object.values(SplitExpenseGrouping).includes(exportSettingsForm.get('splitExpenseGrouping')?.value) + ? exportSettingsForm.get('splitExpenseGrouping')?.value + : SplitExpenseGrouping.MULTIPLE_LINE_ITEM
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
src/app/core/models/xero/xero-configuration/xero-export-settings.model.ts
(1 hunks)
🔇 Additional comments (1)
src/app/core/models/xero/xero-configuration/xero-export-settings.model.ts (1)
222-222
: LGTM: Default value for splitExpenseGrouping is properly handled
The implementation correctly ensures that splitExpenseGrouping always has a value by defaulting to MULTIPLE_LINE_ITEM when not set. This aligns with the PR's objective to fix split lineitem handling.
Let's verify that MULTIPLE_LINE_ITEM is the correct default by checking its usage:
✅ Verification successful
Default value MULTIPLE_LINE_ITEM is consistently used across the codebase
The verification confirms that MULTIPLE_LINE_ITEM is consistently used as the default value across multiple integration models (Xero, QBO, NetSuite, Intacct) and in test fixtures. The implementation in the Xero export settings aligns with this established pattern.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other occurrences of MULTIPLE_LINE_ITEM to confirm consistent default usage
rg "MULTIPLE_LINE_ITEM" --type ts
Length of output: 2240
@@ -219,7 +219,7 @@ export class XeroExportSettingModel { | |||
bankAccount: new FormControl(exportSettings?.general_mappings?.bank_account?.id ? findObjectByDestinationId(destinationAttribute, exportSettings.general_mappings.bank_account.id) : null), | |||
autoMapEmployees: new FormControl(exportSettings?.workspace_general_settings?.auto_map_employees), | |||
searchOption: new FormControl(''), | |||
splitExpenseGrouping: new FormControl(exportSettings?.expense_group_settings?.split_expense_grouping) | |||
splitExpenseGrouping: new FormControl(exportSettings?.expense_group_settings?.split_expense_grouping ? exportSettings?.expense_group_settings?.split_expense_grouping : SplitExpenseGrouping.MULTIPLE_LINE_ITEM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Tests need to be updated for splitExpenseGrouping feature
The test files are currently minimal and disabled (using xdescribe
). None of them cover the new splitExpenseGrouping functionality. Test coverage should be added for:
- Form control initialization with default value
- Form control initialization with existing value
- Payload construction with splitExpenseGrouping
Key files requiring test updates:
- src/app/core/services/xero/xero-configuration/xero-export-settings.service.spec.ts
- src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.spec.ts
- src/app/integrations/xero/xero-onboarding/xero-onboarding-export-settings/xero-onboarding-export-settings.component.spec.ts
🔗 Analysis chain
Verify test coverage for the new splitExpenseGrouping handling
The changes look good overall, but let's ensure they're properly covered by tests.
Let's check for existing test coverage:
Also applies to: 231-231
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for test files that might need updates
rg -l "XeroExportSettingModel" --type ts | grep "spec"
# Search for existing test cases related to split expense grouping
rg "splitExpenseGrouping|split_expense_grouping" --type ts | grep "spec"
Length of output: 125
Script:
#!/bin/bash
# Let's try a broader search for test files related to Xero export settings
rg -l "xero.*export.*settings" --type ts | grep -i "spec\|test"
# Also search for any test files in the same directory
fd ".*spec.ts$|.*test.ts$" -p src/app/core/models/xero/xero-configuration/
# Let's check the actual implementation file to understand the test structure
cat src/app/core/models/xero/xero-configuration/xero-export-settings.model.ts
Length of output: 10508
Script:
#!/bin/bash
# Let's check the test files we found for split expense grouping coverage
cat src/app/core/services/xero/xero-configuration/xero-export-settings.service.spec.ts
cat src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.spec.ts
cat src/app/integrations/xero/xero-onboarding/xero-onboarding-export-settings/xero-onboarding-export-settings.component.spec.ts
Length of output: 2185
Description
Please add PR description here, add screenshots if needed
Clickup
https://app.clickup.com/t/
Summary by CodeRabbit
New Features
splitExpenseGrouping
property in the export settings, ensuring a default value is provided when necessary.Bug Fixes
splitExpenseGrouping
field between form group mapping and payload construction.