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: qbd direct tracking for export and sync on click #1134

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

DhaaraniCIT
Copy link
Contributor

@DhaaraniCIT DhaaraniCIT commented Dec 19, 2024

Description

feat: qbd direct tracking for export and sync on click

Clickup

https://app.clickup.com

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced new tracking capabilities for QuickBooks Desktop integration, including additional event types for export and synchronization.
    • Enhanced tracking functionality in the dashboard component for export events.
  • Bug Fixes

    • Removed unnecessary dependencies to streamline component functionality.
  • Refactor

    • Updated service and component dependencies to utilize tracking services instead of workspace services.
    • Improved clarity of action sequences in QuickBooks Desktop integration events.

Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

Walkthrough

This pull request modifies the QbdDirectUpdateEvent and ClickEvent enums in the enum.model.ts file, updating descriptions and adding new members for enhanced event tracking. The QbdDirectHelperService is updated to include TrackingService, enabling tracking of click events during attribute imports. The QbdDirectDashboardComponent replaces WorkspaceService with TrackingService to track export events, while the QbdDirectMainComponent simplifies its dependencies by removing ToastService and WorkspaceService. Overall, these changes enhance tracking capabilities across the QuickBooks Desktop Direct integration.

Changes

File Change Summary
src/app/core/models/enum/enum.model.ts Updated descriptions for QbdDirectUpdateEvent members; added QBD_DIRECT_EXPORT and QBD_DIRECT_SYNC to ClickEvent
src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts Updated constructor to include TrackingService, added tracking for import attributes
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts Replaced WorkspaceService with TrackingService, added export event tracking
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts Removed ToastService and WorkspaceService dependencies

Possibly related PRs

  • feat: qbd direct pre requisite ts changes #1062: The changes in the main PR regarding the QbdDirectUpdateEvent enum and its members are related to the modifications in the TrackingService and QbdDirectOnboardingConnectorComponent, which also involve tracking events and onboarding states for QBD Direct.
  • feat: QBD direct tracker update #1126: The addition of the QbdDirectUpdateEvent enum in the main PR aligns with the updates in the TrackingService, which now includes handling for QBD Direct update events, enhancing the tracking capabilities for onboarding processes.
  • fix:QBD direct advanced settings fix #1133: The changes in the main PR regarding the QbdDirectUpdateEvent enum are relevant to the updates in the QbdDirectAdvancedSettingsComponent, which now includes tracking functionality that utilizes the new enum for logging onboarding states and events.

Suggested labels

deploy, size/M

Suggested reviewers

  • ashwin1111

Poem

🐰 Hopping through code with glee,
QBD Direct tracking, now we see!
Enums and events, dancing light,
Synchronizing data, pure delight!
A rabbit's leap of tracking might! 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a93a13 and c8e4e71.

📒 Files selected for processing (1)
  • src/app/core/models/enum/enum.model.ts (2 hunks)
🔇 Additional comments (2)
src/app/core/models/enum/enum.model.ts (2)

87-89: LGTM! Clear step numbering improves workflow clarity.

The addition of step numbers (2.1, 2.2, 2.3) in the descriptions provides better clarity on the sequence of actions in the QuickBooks Desktop Connector workflow.


169-170: Maintain consistent naming conventions for enum values

The naming inconsistency with "Quickbooks" vs "QuickBooks" was previously identified. Please ensure consistent naming across the codebase.


🪧 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/S Small PR label Dec 19, 2024
Copy link

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

1 similar comment
Copy link

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

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: 2

🧹 Nitpick comments (1)
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (1)

Line range hint 98-134: Consider refactoring pollExportStatus method

The pollExportStatus method is quite long and handles multiple responsibilities. Consider breaking it down into smaller, more focused methods for better maintainability.

Suggested refactor:

  1. Extract the export progress calculation
  2. Extract the error handling logic
  3. Extract the export summary update logic

Example structure:

private updateExportProgress(processedTasks: number): void {
  this.processedCount = processedTasks;
  this.exportProgressPercentage = Math.round((this.processedCount / this.exportableAccountingExportIds.length) * 100);
}

private handleExportCompletion(taskResults: QbdDirectTaskLog[]): void {
  forkJoin([
    this.getExportErrors$,
    this.getAccountingExportSummary$
  ]).subscribe(this.updateExportSummary.bind(this));
}

private updateExportSummary([errorResponse, exportSummary]: [ErrorResponse, AccountingExportSummary]): void {
  this.errors = DashboardModel.parseAPIResponseToGroupedError(errorResponse.results);
  this.groupedErrorStat = {
    EMPLOYEE_MAPPING: null,
    CATEGORY_MAPPING: null
  };
  this.accountingExportSummary = AccountingExportSummaryModel.parseAPIResponseToAccountingSummaryForQbdDirect(exportSummary);
  // ... rest of the summary update logic
}

private pollExportStatus(exportableAccountingExportIds: number[] = []): void {
  interval(3000).pipe(
    switchMap(() => from(this.dashboardService.getAllTasks([], exportableAccountingExportIds, [], AppName.QBD_DIRECT))),
    takeWhile((response: QbdDirectTaskResponse) =>
      response.results.filter(task =>
        (this.exportLogProcessingStates.includes(task.status))
      ).length > 0, true
    )
  ).subscribe((res: QbdDirectTaskResponse) => {
    const processedTasks = res.results.filter((task: { status: TaskLogState; }) => 
      (task.status !== TaskLogState.IN_PROGRESS && task.status !== TaskLogState.ENQUEUED)).length;
    
    this.updateExportProgress(processedTasks);

    if (res.results.filter((task: { status: TaskLogState; }) => 
      (this.exportLogProcessingStates.includes(task.status))).length === 0) {
      this.handleExportCompletion(res.results);
    }
  });
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7b8b20 and 3a93a13.

📒 Files selected for processing (4)
  • src/app/core/models/enum/enum.model.ts (1 hunks)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts (2 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-dashboard/qbd-direct-dashboard.component.ts (2 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts

[error] 21-21: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

🔇 Additional comments (5)
src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts (2)

17-18: LGTM: TrackingService integration

The TrackingService dependency is correctly injected into the constructor.


26-26: LGTM: Sync tracking implementation

The tracking event is correctly implemented for the sync operation.

src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts (1)

36-36: LGTM: Dependency cleanup

Good cleanup of unused service dependencies, improving code maintainability.

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

86-86: LGTM: TrackingService integration

The TrackingService dependency is correctly injected into the constructor.


92-92: LGTM: Export tracking implementation

The tracking event is correctly implemented for the export operation.

@@ -13,14 +14,16 @@ export class QbdDirectHelperService {
constructor(
private apiService: ApiService,
private workspaceService: WorkspaceService,
private toastService: IntegrationsToastService
private toastService: IntegrationsToastService,
private trackingService: TrackingService
) { }

importQBDAttributes(refresh: boolean): Observable<{}> {
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

Replace {} type with a more specific return type

Using {} as a return type is discouraged as it means "any non-nullable value". Consider defining a specific interface or type for the response.

- importQBDAttributes(refresh: boolean): Observable<{}> {
+ importQBDAttributes(refresh: boolean): Observable<void> {

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Biome (1.9.4)

[error] 21-21: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

Comment on lines +169 to +170
QBD_DIRECT_EXPORT = 'Direct Export Quickbooks Desktop',
QBD_DIRECT_SYNC = 'Sync Quickbooks Desktop Direct'
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

Maintain consistent naming conventions for enum values

The new enum values have inconsistent naming patterns compared to existing QuickBooks-related entries:

  1. "Quickbooks" should be "QuickBooks" (two words) to match existing entries
  2. Word order should follow the established pattern

Apply this diff to maintain consistency:

-  QBD_DIRECT_EXPORT = 'Direct Export Quickbooks Desktop',
-  QBD_DIRECT_SYNC = 'Sync Quickbooks Desktop Direct'
+  QBD_DIRECT_EXPORT = 'Export QuickBooks Desktop Direct',
+  QBD_DIRECT_SYNC = 'Sync QuickBooks Desktop Direct'
📝 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
QBD_DIRECT_EXPORT = 'Direct Export Quickbooks Desktop',
QBD_DIRECT_SYNC = 'Sync Quickbooks Desktop Direct'
QBD_DIRECT_EXPORT = 'Export QuickBooks Desktop Direct',
QBD_DIRECT_SYNC = 'Sync QuickBooks Desktop Direct'

Copy link

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

Copy link

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

Copy link

Unit Test Coverage % values
Statements 33.33% ( 4129 / 12387 )
Branches 26.73% ( 1181 / 4418 )
Functions 25.88% ( 896 / 3461 )
Lines 33.51% ( 4063 / 12124 )

@DhaaraniCIT DhaaraniCIT merged commit 69d2ec0 into master Dec 20, 2024
4 checks passed
DhaaraniCIT added a commit that referenced this pull request Dec 20, 2024
* feat: qbd direct tracking for export and sync on click

* wording change for connector page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants