Skip to content
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: netsuite > category mapping errors > dialogue > table header text #1045

Merged

Conversation

JustARatherRidiculouslyLongUsername
Copy link
Contributor

@JustARatherRidiculouslyLongUsername JustARatherRidiculouslyLongUsername commented Oct 28, 2024

Description

bugfix to show "Expense Category" instead of "Account" in the table header when ccc export type is Expense Report.

Clickup

app.clickup.com

Summary by CodeRabbit

  • New Features

    • Enhanced logic for determining the CATEGORY in the Netsuite dashboard.
  • Bug Fixes

    • Improved error handling for the accounting export summary to prevent application crashes.
  • Chores

    • Updated import paths for consistency in the QbdDirectExportSettingsComponent.
  • Tests

    • Disabled various test suites for QbdDirect components to streamline testing process.

…header text

bugfix to show "Expense Category" instead of "Account" in the table header when ccc export type is Expense Report.
Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes in this pull request involve modifications to the NetsuiteDashboardComponent class within the specified TypeScript file. The primary updates include altering the logic for determining the CATEGORY property in the destinationFieldMap and enhancing error handling for the observable that retrieves the accounting export summary. The error handling now utilizes the catchError operator to return of(null) in case of an error, ensuring smoother error management during the page setup.

Changes

File Change Summary
src/app/integrations/netsuite/netsuite-main/netsuite-dashboard/netsuite-dashboard.component.ts Modified setupPage method to update CATEGORY assignment logic and improved error handling with catchError.
src/app/core/services/common/helper.service.ts Updated setBaseApiURL method to conditionally assign qbd_direct_api_url from the environment.
src/app/integrations/qbd-direct/qbd-direct-configuration/*.spec.ts Disabled test suites by changing describe to xdescribe for multiple services.
src/app/integrations/qbd-direct/qbd-direct-main/*.spec.ts Disabled test suites by changing describe to xdescribe for multiple components.
src/app/integrations/qbd-direct/qbd-direct-shared/*.spec.ts Disabled test suites by changing describe to xdescribe for multiple components.
src/app/integrations/qbd-direct/qbd-direct.component.spec.ts Disabled test suite by changing describe to xdescribe.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts Updated import path for QBDExportSettingFormOption to a relative path.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/*.spec.ts Disabled test suites by changing describe to xdescribe for multiple components.

Possibly related PRs

  • netsuite import setting tax destination attributite call change #944: The changes in the NetsuiteImportSettingsComponent relate to how destination attributes are processed, which may connect to the modifications in the NetsuiteDashboardComponent regarding the handling of expense categories.
  • fix: page size change not updating localstorage #990: The updates in the IntacctCompletedExportLogComponent regarding pagination and search functionality could relate to the error handling improvements in the NetsuiteDashboardComponent, as both involve managing data display and user interactions.
  • test: intacct import settings save functionality #1009: The enhancements in the IntacctImportSettingsComponent for managing import code fields may connect to the changes in the NetsuiteDashboardComponent, as both involve refining logic for handling specific data fields.
  • fix: intacct prepend code field fix #1011: The fix in the IntacctImportSettingsComponent for preventing duplicate entries in import code fields relates to the logic changes in the NetsuiteDashboardComponent, which also involves managing data integrity.
  • test: intacct advanced settings initialization #1024: The modifications in the IntacctAdvancedSettingsComponent for initialization and form control validation may relate to the changes in the NetsuiteDashboardComponent, as both involve ensuring correct data handling and user interface behavior.
  • refactor: remove duplicate tests #1028: The refactoring of tests in the IntacctExportSettingsComponent to remove duplicates may connect to the overall improvements in the NetsuiteDashboardComponent, as both aim to enhance code quality and maintainability.
  • fix: patch "Report Title" option to "Report Name" in skip export #1034: The terminology update in the skip export functionality across various integrations, including Intacct, may relate to the changes in the NetsuiteDashboardComponent, as both aim to improve user clarity and consistency.
  • fix: update qbd mapping page field placeholder #1035: The update to the QBD mapping page field placeholder may connect to the changes in the NetsuiteDashboardComponent, as both involve enhancing user guidance in data entry fields.
  • test: fix tests for github action #1037: The modifications to the GitHub Actions workflow for unit testing may indirectly relate to the overall improvements in the NetsuiteDashboardComponent, as both aim to enhance the reliability and functionality of the application.

Suggested labels

size/XS

Suggested reviewers

  • DhaaraniCIT
  • ashwin1111

Poem

🐇 In the meadow where changes bloom,
The dashboard now finds more room.
Categories shift, errors are caught,
With every update, new lessons taught!
Hops of joy, let the data flow,
In Netsuite's world, watch us grow! 🌼


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/XS Extra Small PR label Oct 28, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (1)
src/app/integrations/netsuite/netsuite-main/netsuite-dashboard/netsuite-dashboard.component.ts (1)

132-132: Consider extracting the complex condition into a helper method.

While the logic is correct and aligns with the PR objective to fix category mapping, the condition could be made more readable by extracting it into a helper method.

Consider refactoring like this:

-        CATEGORY: (responses[4].configuration.reimbursable_expenses_object === NetsuiteReimbursableExpensesObject.EXPENSE_REPORT || responses[4].configuration.corporate_credit_card_expenses_object === NetSuiteCorporateCreditCardExpensesObject.EXPENSE_REPORT) ? NetsuiteCategoryDestination.EXPENSE_CATEGORY : NetsuiteCategoryDestination.ACCOUNT
+        CATEGORY: this.getCategoryDestination(responses[4].configuration)

+ private getCategoryDestination(configuration: any): string {
+   const isExpenseReport = 
+     configuration.reimbursable_expenses_object === NetsuiteReimbursableExpensesObject.EXPENSE_REPORT || 
+     configuration.corporate_credit_card_expenses_object === NetSuiteCorporateCreditCardExpensesObject.EXPENSE_REPORT;
+   
+   return isExpenseReport 
+     ? NetsuiteCategoryDestination.EXPENSE_CATEGORY 
+     : NetsuiteCategoryDestination.ACCOUNT;
+ }

This refactoring:

  1. Improves readability by giving the logic a descriptive name
  2. Makes the code more maintainable
  3. Makes the condition easier to test
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1922b12 and bf5031b.

📒 Files selected for processing (1)
  • src/app/integrations/netsuite/netsuite-main/netsuite-dashboard/netsuite-dashboard.component.ts (1 hunks)
🔇 Additional comments (1)
src/app/integrations/netsuite/netsuite-main/netsuite-dashboard/netsuite-dashboard.component.ts (1)

131-132: LGTM: Improved error handling for accounting export summary.

The addition of error handling using catchError operator is a good defensive programming practice. It ensures the application continues to function even if the accounting export summary request fails.

@github-actions github-actions bot added size/M Medium PR and removed size/XS Extra Small PR labels Oct 28, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bf5031b and 2068324.

📒 Files selected for processing (30)
  • src/app/core/services/common/helper.service.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-export-settings.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-import-settings.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-auth.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-connector.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-mappings.service.spec.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-workspace.service.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-configuration/qbd-direct-configuration.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-export-log/qbd-direct-complete-export-log/qbd-direct-complete-export-log.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-export-log/qbd-direct-export-log.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-export-log/qbd-direct-skipped-export-log/qbd-direct-skipped-export-log.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-mapping.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-advanced-settings/qbd-direct-onboarding-advanced-settings.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-done/qbd-direct-onboarding-done.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-export-settings/qbd-direct-onboarding-export-settings.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-import-settings/qbd-direct-onboarding-import-settings.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-landing/qbd-direct-onboarding-landing.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-shared.component.spec.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct.component.spec.ts (1 hunks)
✅ Files skipped from review due to trivial changes (29)
  • src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-advanced-settings.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-export-settings.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-configuration/qbd-direct-import-settings.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-auth.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-connector.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-mappings.service.spec.ts
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-workspace.service.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-configuration/qbd-direct-configuration.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-export-log/qbd-direct-complete-export-log/qbd-direct-complete-export-log.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-export-log/qbd-direct-export-log.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-export-log/qbd-direct-skipped-export-log/qbd-direct-skipped-export-log.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-base-mapping/qbd-direct-base-mapping.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-mapping/qbd-direct-mapping.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-advanced-settings/qbd-direct-onboarding-advanced-settings.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-connector/qbd-direct-onboarding-connector.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-done/qbd-direct-onboarding-done.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-export-settings/qbd-direct-onboarding-export-settings.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-import-settings/qbd-direct-onboarding-import-settings.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding-landing/qbd-direct-onboarding-landing.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-onboarding/qbd-direct-onboarding.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-shared.component.spec.ts
  • src/app/integrations/qbd-direct/qbd-direct.component.spec.ts
🔇 Additional comments (1)
src/app/core/services/common/helper.service.ts (1)

55-55: Verify PR scope: Changes seem unrelated to NetSuite category mapping.

The change to QBD Direct API URL handling appears unrelated to the PR's stated objective of fixing NetSuite category mapping errors in the dialogue table header text. Please clarify if this change is intentional or if it should be in a separate PR.

Let's verify if there are any NetSuite-related changes that might have been missed:

@@ -52,7 +52,7 @@ export class HelperService {
const apiUrlMap: AppUrlMap = {
[AppUrl.INTACCT]: environment.production ? `${this.apiBaseUrl}/intacct-api/api` : environment.si_api_url,
[AppUrl.QBD]: environment.qbd_api_url,
[AppUrl.QBD_DIRECT]: environment.qbd_direct_api_url,
[AppUrl.QBD_DIRECT]: ('qbd_direct_api_url' in environment) ? environment.qbd_direct_api_url as string : "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider using nullish coalescing for URL fallback.

While the defensive check for qbd_direct_api_url existence is good, consider using the nullish coalescing operator for a more concise implementation.

-      [AppUrl.QBD_DIRECT]: ('qbd_direct_api_url' in environment) ? environment.qbd_direct_api_url as string : "",
+      [AppUrl.QBD_DIRECT]: environment.qbd_direct_api_url ?? "",

This achieves the same result but is more idiomatic in modern TypeScript. The nullish coalescing operator (??) will return the right-hand side only when the left-hand side is null or undefined, which is exactly what we want here.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[AppUrl.QBD_DIRECT]: ('qbd_direct_api_url' in environment) ? environment.qbd_direct_api_url as string : "",
[AppUrl.QBD_DIRECT]: environment.qbd_direct_api_url ?? "",

@github-actions github-actions bot added size/XS Extra Small PR and removed size/M Medium PR labels Oct 28, 2024
Copy link

github-actions bot commented Nov 4, 2024

Unit Test Coverage % values
Statements 35.39% ( 4222 / 11929 )
Branches 29.01% ( 1228 / 4232 )
Functions 27.96% ( 935 / 3344 )
Lines 35.52% ( 4148 / 11676 )

@JustARatherRidiculouslyLongUsername JustARatherRidiculouslyLongUsername merged commit c107ffd into master Nov 4, 2024
4 checks passed
This was referenced Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Extra Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants