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

feat: intacct code prepend fixes #965

Merged
merged 4 commits into from
Sep 24, 2024
Merged

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Sep 19, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new input property for improved handling of accepted code fields in the dashboard.
    • Expanded accepted fields for mapping to include a new expense type.
    • Added new form controls related to import codes in the import settings.
  • Bug Fixes

    • Adjusted import settings logic for better handling of field processing and category determination.
  • Improvements

    • Enhanced data validation and mapping capabilities in the dashboard.
    • Refined logic for transforming destination field names to prevent unnecessary pluralization.
    • Updated source field binding for improved mapping context.

Copy link
Contributor

coderabbitai bot commented Sep 19, 2024

Walkthrough

The pull request introduces several changes across multiple components in the Intacct integration. Key modifications include the addition of a new input property [importCodeFields] for handling specific code fields during import operations, updates to the logic for import settings, and refinements in the handling of mapping fields. Additionally, some imports were removed and new ones added, indicating a shift in dependencies and functionality within the components.

Changes

Files Change Summary
src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.html
src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.ts
Added [importCodeFields] property to app-dashboard-error-section and introduced acceptedCodeField array with specific fields, modifying component dependencies.
src/app/integrations/intacct/intacct-main/intacct-mapping/intacct-base-mapping/intacct-base-mapping.component.ts Expanded acceptedCodeField array to include IntacctCategoryDestination.EXPENSE_TYPE, enhancing mapping capabilities.
src/app/integrations/intacct/intacct-shared/intacct-import-settings/intacct-import-settings.component.ts Modified import settings logic, including changing default value for import_to_fyle and refining conditions for handling source fields and import code fields. Added new enums for expense objects.
src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.html Changed binding of sourceField in <app-card-mapping-header> from sourceField to sourceType.
src/app/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.ts Introduced a new regex pattern to control the transformation of destinationField names, preventing pluralization for certain cases.

Possibly related PRs

Suggested reviewers

  • ashwin1111

🐰 "In the meadow where changes bloom,
New fields sprout, dispelling gloom.
With code fields dancing, bright and fair,
Import settings breathe fresh air.
A hop, a skip, let's celebrate,
Our dashboard's fate, oh, how great!" 🌼


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.

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/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.ts (1)

31-38: LGTM! Consider using a regular expression literal.

The new regular expression pattern correctly handles field names containing special characters, enhancing the robustness of the transformation logic.

Based on the static analysis hint, consider using a regular expression literal instead of the RegExp constructor for improved performance and maintainability.

Apply this diff to use a regular expression literal:

-const pattern = new RegExp('[^a-zA-Z\d\s:]');
+const pattern = /[^a-zA-Z\d\s:]/;
Tools
Biome

[error] 31-31: Use a regular expression literal instead of the RegExp constructor.

Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.

(lint/complexity/useRegexLiterals)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 87a7a5c and 19c775f.

Files selected for processing (6)
  • src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.html (1 hunks)
  • src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.ts (2 hunks)
  • src/app/integrations/intacct/intacct-main/intacct-mapping/intacct-base-mapping/intacct-base-mapping.component.ts (1 hunks)
  • src/app/integrations/intacct/intacct-shared/intacct-import-settings/intacct-import-settings.component.ts (5 hunks)
  • src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.html (1 hunks)
  • src/app/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.ts (1 hunks)
Additional context used
Biome
src/app/shared/components/helper/mapping/mapping-card-header/mapping-card-header.component.ts

[error] 31-31: Use a regular expression literal instead of the RegExp constructor.

Regular expression literals avoid some escaping required in a string literal, and are easier to analyze statically.
Safe fix: Use a literal notation instead.

(lint/complexity/useRegexLiterals)

Additional comments not posted (9)
src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.html (1)

44-44: LGTM!

The addition of the [importCodeFields] input property to the app-dashboard-error-section component is a good enhancement to handle specific code fields during the import process.

To ensure the correctness of this change, please verify that the acceptedCodeField variable is correctly populated with the expected set of code fields. You can add a console log or a debugger statement to inspect the value of acceptedCodeField during runtime.

src/app/shared/components/helper/mapping/generic-mapping-v2/generic-mapping-v2.component.html (1)

7-7: Verify the app-card-mapping-header component handles the sourceType property correctly.

The change in property binding from sourceField to sourceType looks good. However, please ensure that the app-card-mapping-header component is equipped to handle the sourceType property and that it displays the correct data in the header.

Run the following script to verify the usage of the sourceType property in the app-card-mapping-header component:

src/app/integrations/intacct/intacct-main/intacct-mapping/intacct-base-mapping/intacct-base-mapping.component.ts (1)

41-41: LGTM! Verify the impact of this change on the codebase.

The addition of IntacctCategoryDestination.EXPENSE_TYPE to the acceptedCodeField array is a valid change that expands the component's capability to handle expense-related data. This aligns with the overall purpose of the component.

Please ensure that this change is properly handled in other parts of the codebase that interact with this component. You can use the following script to search for potential impact areas:

Verification successful

Verification complete: Change is consistent and properly implemented.

The addition of IntacctCategoryDestination.EXPENSE_TYPE to the acceptedCodeField array has been consistently applied across the codebase. This change is present in both the IntacctBaseMappingComponent and the IntacctDashboardComponent, ensuring consistency in the handling of expense types.

The IntacctBaseMappingComponent is properly integrated into the module structure, routing, and has a corresponding test file. This indicates that the change has been implemented correctly and is well-supported within the existing architecture.

Based on this analysis, no further manual verification is required. The change appears to be correctly implemented and doesn't have any negative impact on the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of `acceptedCodeField` in the codebase.

# Test: Search for the variable usage. Expect: Occurrences in relevant files.
rg --type typescript -A 5 $'acceptedCodeField'

Length of output: 80


Script:

#!/bin/bash
# Description: Search for usage of `acceptedCodeField` in TypeScript files

# Approach 1: Using fd to find TypeScript files and xargs to run rg
echo "Approach 1: Using fd and xargs"
fd -e ts -e tsx | xargs rg -n -A 5 'acceptedCodeField'

# Approach 2: Using rg with file extension patterns
echo "Approach 2: Using rg with file extension patterns"
rg -n -A 5 'acceptedCodeField' --glob '*.{ts,tsx}'

# Additional search: Look for files that import or use IntacctBaseMapping
echo "Additional search: Files importing or using IntacctBaseMapping"
rg -n -A 5 'IntacctBaseMapping' --glob '*.{ts,tsx}'

Length of output: 10337

src/app/integrations/intacct/intacct-main/intacct-dashboard/intacct-dashboard.component.ts (2)

2-4: LGTM!

The changes in the import statements are appropriate and align with the component's functionality.


89-90: Verify the usage of the acceptedCodeField property.

The acceptedCodeField property is added to the component, but it is not used anywhere else in the component's logic. Please ensure that this property is properly utilized or remove it if it is no longer needed to avoid confusion and maintain code clarity.

src/app/integrations/intacct/intacct-shared/intacct-import-settings/intacct-import-settings.component.ts (4)

8-8: LGTM!

The newly imported enums will help make the code more readable and maintainable by using named constants.


301-301: LGTM!

The changes in the addImportCodeField method look good:

  • Mapping GL_ACCOUNT to ACCOUNT standardizes the field name.
  • Validating against acceptedImportCodeField ensures only allowed fields are added.
  • Correctly handles adding/removing the form group based on event.checked.

555-558: LGTM!

The changes in the initializeForm method look good:

  • Mapping GL_ACCOUNT to ACCOUNT ensures the correct field is used in subsequent logic.
  • The multiple checks before adding the import code field ensure it's added only when necessary and with proper configuration.

Also applies to: 560-560


642-642: LGTM!

Using the reimbursable_expenses_object and corporate_credit_card_expenses_object configurations to determine the intacctCategoryDestination is a good approach. It ensures the correct category is used during import based on the expense object setup.

@@ -28,11 +28,14 @@ export class MappingCardHeaderComponent implements OnInit {
destinationField = new SnakeCaseToSpaceCasePipe().transform(destinationField).toLowerCase();
const lastChar = destinationField.slice(-1).toLowerCase();
const lastTwoChars = destinationField.slice(-2).toLowerCase();
const pattern = new RegExp('[^a-zA-Z\d\s:]');
Copy link
Contributor

Choose a reason for hiding this comment

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

what are we doing here?

@@ -4,7 +4,7 @@

<div>
<div>
<app-card-mapping-header *ngIf="mappings" (triggerAutoMapEmployee)="triggerAutoMapEmployees()" [sourceField]="sourceField" [showAutoMapEmployee]="showAutoMapEmployee" [mappingStats]="mappingStats" (triggerAutoMapEmployee)="triggerAutoMapEmployees"></app-card-mapping-header>
<app-card-mapping-header *ngIf="mappings" (triggerAutoMapEmployee)="triggerAutoMapEmployees()" [sourceField]="sourceType" [showAutoMapEmployee]="showAutoMapEmployee" [mappingStats]="mappingStats" (triggerAutoMapEmployee)="triggerAutoMapEmployees()"></app-card-mapping-header>
Copy link
Contributor

Choose a reason for hiding this comment

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

affects all app, please test mapping page for every integration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, tested @ashwin1111 all are working fine

@DhaaraniCIT DhaaraniCIT added deploy Triggers deployment of active branch to Staging c1_staging_deploy Deploys to c1 staging labels Sep 20, 2024
@github-actions github-actions bot added the size/S Small PR label Sep 24, 2024
Copy link

PR title must start with "fix:", "feat:", "chore:", "refactor", or "test:" (case-insensitive)

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

@DhaaraniCIT DhaaraniCIT changed the title intacct code prepend fixes feat: intacct code prepend fixes Sep 24, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c1_staging_deploy Deploys to c1 staging deploy Triggers deployment of active branch to Staging size/S Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants