-
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
feat: poc for date grouping #1174
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request introduces new static methods in the Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Component as QBO Export Settings Component
participant Model as ExportSettingModel
User->>Component: Triggers update of expense grouping options
Component->>Model: Call dateGrouping(exportType, expenseGrouping, showApprovedDate, showVerificationDate)
Model-->>Component: Returns filtered date options
Component->>User: Renders updated options
Suggested labels
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
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 (
|
PR description must contain a link to a ClickUp (case-insensitive) |
1 similar comment
PR description must contain a link to a ClickUp (case-insensitive) |
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: 0
🧹 Nitpick comments (3)
src/app/core/models/common/export-settings.model.ts (2)
112-135
: Fix typo in function name.The function name should be plural to match its return type.
Apply this diff to fix the typo:
-static getReimbursableExpenseGroupingDateOption(): SelectFormOption[] { +static getReimbursableExpenseGroupingDateOptions(): SelectFormOption[] {
137-161
: Clean up code style and improve type safety.The function has the following issues:
- Inconsistent spacing
- Use of 'this' in static context
- Unnecessary type assertion in filter callback
Apply this diff to improve the code:
-static dateGrouping(exportType:string, expenseGrouping: string, showApprovedDate: boolean, showVerificationDate: boolean): SelectFormOption[] { - - const excludedDate = expenseGrouping === 'expense' - ? ExportDateType.LAST_SPENT_AT - : ExportDateType.SPENT_AT; - - if (exportType === 'CCC') { - return this.getCreditCardExpenseGroupingDateOptions().filter(option => option.value !== excludedDate); - } - - let dateOptions = this.getReimbursableExpenseGroupingDateOption(); - let filterOptions: ExportDateType[] = []; - - if (showApprovedDate) { - filterOptions.push(ExportDateType.VERIFIED_AT); - } else if (showVerificationDate) { - filterOptions.push(ExportDateType.APPROVED_AT); - } - - filterOptions.push(excludedDate); - - return dateOptions.filter((item): item is { label: string; value: ExportDateType } => - item.value !== null && !filterOptions.includes(item.value as ExportDateType)) +static dateGrouping(exportType: string, expenseGrouping: string, showApprovedDate: boolean, showVerificationDate: boolean): SelectFormOption[] { + const excludedDate = expenseGrouping === 'expense' + ? ExportDateType.LAST_SPENT_AT + : ExportDateType.SPENT_AT; + + if (exportType === 'CCC') { + return ExportSettingModel.getCreditCardExpenseGroupingDateOptions().filter(option => option.value !== excludedDate); + } + + const dateOptions = ExportSettingModel.getReimbursableExpenseGroupingDateOptions(); + const filterOptions: ExportDateType[] = []; + + if (showApprovedDate) { + filterOptions.push(ExportDateType.VERIFIED_AT); + } else if (showVerificationDate) { + filterOptions.push(ExportDateType.APPROVED_AT); + } + + filterOptions.push(excludedDate); + + return dateOptions.filter(item => item.value !== null && !filterOptions.includes(item.value));🧰 Tools
🪛 Biome (1.9.4)
[error] 144-144: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
[error] 147-147: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.(lint/complexity/noThisInStatic)
🪛 ESLint
[error] 138-138: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 139-139: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 140-140: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 142-142: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 147-147: 'dateOptions' is never reassigned. Use 'const' instead.
(prefer-const)
[error] 148-148: 'filterOptions' is never reassigned. Use 'const' instead.
(prefer-const)
[error] 157-157: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 159-160: Missing semicolon.
(semi)
🪛 GitHub Check: lint
[failure] 138-138:
Trailing spaces not allowed
[failure] 139-139:
Trailing spaces not allowed
[failure] 140-140:
Trailing spaces not allowed
[failure] 142-142:
Trailing spaces not allowed
[failure] 147-147:
'dateOptions' is never reassigned. Use 'const' instead
[failure] 148-148:
'filterOptions' is never reassigned. Use 'const' instead
[failure] 157-157:
Trailing spaces not allowed
[failure] 159-159:
Missing semicolon🪛 GitHub Actions: TypeScript Lint Check
[error] 138-138: Trailing spaces not allowed
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts (1)
344-359
: Clean up commented code and fix semicolons.
- Remove commented code as it's tracked in version control.
- Add missing semicolons.
Apply this diff to clean up the code:
- // this.reimbursableExpenseGroupingDateOptions = QBOExportSettingModel.getReimbursableExpenseGroupingDateOptions(); - // this.reimbursableExpenseGroupingDateOptions = ExportSettingModel.constructGroupingDateOptions(reimbursableExportGroup, this.reimbursableExpenseGroupingDateOptions); - this.reimbursableExpenseGroupingDateOptions = ExportSettingModel.dateGrouping('rem', this.exportSettingForm.controls.reimbursableExportGroup.value, true, false) + this.reimbursableExpenseGroupingDateOptions = ExportSettingModel.dateGrouping('rem', this.exportSettingForm.controls.reimbursableExportGroup.value, true, false); - // // this.cccExpenseGroupingDateOptions = QBOExportSettingModel.getReimbursableExpenseGroupingDateOptions(); - // // this.cccExpenseGroupingDateOptions = ExportSettingModel.constructGroupingDateOptions(creditCardExportGroup, this.cccExpenseGroupingDateOptions); - this.cccExpenseGroupingDateOptions = ExportSettingModel.dateGrouping('rem', creditCardExportGroup, true, false) + this.cccExpenseGroupingDateOptions = ExportSettingModel.dateGrouping('rem', creditCardExportGroup, true, false);🧰 Tools
🪛 ESLint
[error] 344-344: Comments should not begin with a lowercase character.
(capitalized-comments)
[error] 345-345: Comments should not begin with a lowercase character.
(capitalized-comments)
[error] 346-347: Missing semicolon.
(semi)
[error] 358-359: Missing semicolon.
(semi)
🪛 GitHub Check: lint
[failure] 344-344:
Comments should not begin with a lowercase character
[failure] 345-345:
Comments should not begin with a lowercase character
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/app/core/models/common/export-settings.model.ts
(2 hunks)src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts
(2 hunks)
🧰 Additional context used
🪛 ESLint
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts
[error] 344-344: Comments should not begin with a lowercase character.
(capitalized-comments)
[error] 345-345: Comments should not begin with a lowercase character.
(capitalized-comments)
[error] 346-347: Missing semicolon.
(semi)
src/app/core/models/common/export-settings.model.ts
[error] 138-138: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 139-139: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 140-140: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 142-142: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 147-147: 'dateOptions' is never reassigned. Use 'const' instead.
(prefer-const)
[error] 148-148: 'filterOptions' is never reassigned. Use 'const' instead.
(prefer-const)
[error] 157-157: Trailing spaces not allowed.
(no-trailing-spaces)
[error] 159-160: Missing semicolon.
(semi)
🪛 GitHub Check: lint
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts
[failure] 344-344:
Comments should not begin with a lowercase character
[failure] 345-345:
Comments should not begin with a lowercase character
src/app/core/models/common/export-settings.model.ts
[failure] 138-138:
Trailing spaces not allowed
[failure] 139-139:
Trailing spaces not allowed
[failure] 140-140:
Trailing spaces not allowed
[failure] 142-142:
Trailing spaces not allowed
[failure] 147-147:
'dateOptions' is never reassigned. Use 'const' instead
[failure] 148-148:
'filterOptions' is never reassigned. Use 'const' instead
[failure] 157-157:
Trailing spaces not allowed
[failure] 159-159:
Missing semicolon
🪛 Biome (1.9.4)
src/app/core/models/common/export-settings.model.ts
[error] 144-144: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.
(lint/complexity/noThisInStatic)
[error] 147-147: Using this in a static context can be confusing.
this refers to the class.
Unsafe fix: Use the class name instead.
(lint/complexity/noThisInStatic)
🪛 GitHub Actions: TypeScript Lint Check
src/app/core/models/common/export-settings.model.ts
[error] 138-138: Trailing spaces not allowed
🔇 Additional comments (2)
src/app/core/models/common/export-settings.model.ts (1)
91-110
: LGTM! Well-structured date options for credit card expenses.The function provides a comprehensive set of date options for credit card expense grouping, with proper labels and values.
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts (1)
318-320
: LGTM! Consistent usage of the new date grouping method.The method correctly utilizes
ExportSettingModel.dateGrouping
with appropriate parameters based on the export type.
Description
feat: poc for date grouping
Clickup
Please add link here
Summary by CodeRabbit