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: Successful export dialog view #1160

Merged
merged 4 commits into from
Jan 22, 2025
Merged

Conversation

ashwin1111
Copy link
Contributor

@ashwin1111 ashwin1111 commented Jan 22, 2025

Description

Please add PR description here, add screenshots if needed

Clickup

https://app.clickup.com/

Summary by CodeRabbit

  • Bug Fixes
    • Updated accounting export retrieval method to simplify date filtering logic
    • Removed explicit date filter construction when fetching accounting exports
  • Improvements
    • Streamlined logic for updating expense grouping date options across various export settings components by removing brand-specific checks.

Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Warning

Rate limit exceeded

@ashwin1111 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 48 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 22bffc5 and 87ecfb9.

📒 Files selected for processing (1)
  • .github/workflows/unit-test.yml (1 hunks)

Walkthrough

The pull request modifies the getAccountingExports method in the DashboardExportSummarySectionComponent. The primary change involves removing the date filter construction when calling the accountingExportService.getAccountingExports method. Instead of creating a dateFilter object based on the lastExportedAt parameter, the method now passes null. This alteration simplifies the method's internal logic for fetching accounting exports and potentially changes how exports are retrieved based on date criteria. Additionally, the setupCustomWatchers method in various components has been updated to remove brand-specific conditional checks, ensuring that expense grouping date options are always updated.

Changes

File Change Summary
src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.ts Removed date filter construction in getAccountingExports method, now passing null instead of a constructed date filter.
src/app/core/models/common/export-settings.model.ts Improved readability of equality checks in constructGroupingDateOptions method without changing functionality.
src/app/integrations/business-central/business-central-shared/business-central-export-settings/business-central-export-settings.component.ts Removed conditional checks for brandingConfig.brandId in setupCustomWatchers, ensuring options are updated unconditionally.
src/app/integrations/intacct/intacct-shared/intacct-export-settings/intacct-export-settings.component.ts Removed conditional checks for brandingConfig.brandId in setupCustomWatchers, ensuring options are updated unconditionally.
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts Removed conditional checks for brandingConfig.brandId in setupCustomDateOptionWatchers, ensuring options are updated unconditionally.
src/app/integrations/sage300/sage300-shared/sage300-export-settings/sage300-export-settings.component.ts Removed conditional checks for brandingConfig.brandId in setupCustomWatchers, ensuring options are updated unconditionally.
src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.ts Removed conditional checks for brandingConfig.brandId in setupCustomWatchers, ensuring options are updated unconditionally.

Possibly related PRs

Suggested labels

size/S, qa_deploy

Suggested reviewers

  • DhaaraniCIT
  • Hrishabh17

Poem

🐰 Exports dance free, no date in sight,
Filtering logic takes flight!
Null replaces complex arrays,
A rabbit's code-hopping ways 🥕
Simplicity wins the coding fight!


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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/XL Extra Large PR label Jan 22, 2025
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 comments (1)
src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.ts (1)

Line range hint 78-83: Consider maintaining consistency with v1 implementation.

The v1 implementation in getExpenseGroups uses date filtering, while v2 removes it. This inconsistency could lead to different behaviors between versions.

Consider one of these approaches:

  1. Apply the same date filtering logic as v1:
-    this.accountingExportService.getAccountingExports(this.accountingExportType, [status], null, limit, offset, null, lastExportedAt, null, this.appName)
+    const dateFilter = lastExportedAt ? {
+      startDate: new Date(lastExportedAt),
+      endDate: new Date()
+    } : null;
+    this.accountingExportService.getAccountingExports(this.accountingExportType, [status], dateFilter, limit, offset, null, lastExportedAt, null, this.appName)
  1. Update v1 to match v2 if date filtering is handled server-side.
🧹 Nitpick comments (1)
src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.ts (1)

Line range hint 78-83: Verify error handling for the API call.

The subscription to the API response lacks error handling, which could lead to unhandled exceptions if the API call fails.

Consider adding error handling:

     this.accountingExportService.getAccountingExports(this.accountingExportType, [status], null, limit, offset, null, lastExportedAt, null, this.appName).subscribe(
-      accountingExportResponse => {
+      {
+        next: (accountingExportResponse) => {
         const accountingExports: AccountingExportList[] = accountingExportResponse.results.map((accountingExport: AccountingExport) =>
           AccountingExportModel.parseAPIResponseToExportLog(accountingExport, this.org_id)
         );
         this.setFormattedAccountingExport(accountingExports);
+        },
+        error: (error) => {
+          // Handle API errors appropriately
+          console.error('Failed to fetch accounting exports:', error);
+        }
       }
     );
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1d05001 and bd89729.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.ts (1 hunks)
🔇 Additional comments (1)
src/app/shared/components/dashboard/dashboard-export-summary-section/dashboard-export-summary-section.component.ts (1)

78-78: Verify the intentional removal of date filtering.

The removal of date filtering logic differs from the v1 implementation in getExpenseGroups. This change could affect how exports are filtered and displayed, especially for completed exports where lastExportedAt is provided.

Please confirm:

  1. Is this an intentional change to remove date-based filtering?
  2. Does the backend API handle the date filtering when null is passed?

Let's verify the API behavior with this script:

✅ Verification successful

Removal of date filtering is intentional for the dashboard summary view

The change is verified to be intentional and correctly implemented:

  • Dashboard summary section uses a simplified query without date filtering
  • Detailed export logs across all integrations maintain date filtering capability
  • The API service accepts null as a valid parameter for date filter
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the API endpoint implementation to verify null date filter handling
rg -t ts "getAccountingExports.*\(" --glob "!*.spec.ts" -A 10

Length of output: 76260

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

🧹 Nitpick comments (3)
src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts (2)

351-352: Consider standardizing date options handling across expense types.

The reimbursable date options are now handled without brand checks, while CCC options still maintain brand-specific logic. This pattern is similar to the Xero implementation.

Consider standardizing the handling of both reimbursable and CCC date options to maintain consistency across the codebase.


Line range hint 113-116: Consider complete standardization of date options handling.

The changes across components show a pattern of removing brand-specific logic for reimbursable expense date options while maintaining it for CCC options. This creates an inconsistency in the codebase.

Recommendations:

  1. Standardize the handling of both reimbursable and CCC date options
  2. Document any business requirements that necessitate different handling
  3. Consider extracting common date options logic into a shared service

Also applies to: 122-123, 127-128, 162-173, 351-352

src/app/integrations/intacct/intacct-shared/intacct-export-settings/intacct-export-settings.component.ts (1)

Line range hint 527-534: Consider removing the remaining brand-specific check for consistency.

The code still contains a brand-specific check for 'fyle' in the CCC export group handler. For consistency with the reimbursable expense handler above, consider removing this check to ensure uniform behavior across all brands.

    this.exportSettingsForm.controls.cccExportGroup?.valueChanges.subscribe((cccExportGroup) => {
-     if (brandingConfig.brandId==='fyle') {
        this.cccExpenseGroupingDateOptions = IntacctExportSettingModel.getExpenseGroupingDateOptions();
        this.cccExpenseGroupingDateOptions = ExportSettingModel.constructGroupingDateOptions(cccExportGroup, this.cccExpenseGroupingDateOptions);
        if (this.exportSettingsForm?.value.cccExportType === IntacctCorporateCreditCardExpensesObject.CHARGE_CARD_TRANSACTION) {
          this.setCCExpenseDateOptions(this.exportSettingsForm?.value.cccExportType);
        }
-     }
    });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bd89729 and 22bffc5.

📒 Files selected for processing (6)
  • src/app/core/models/common/export-settings.model.ts (1 hunks)
  • src/app/integrations/business-central/business-central-shared/business-central-export-settings/business-central-export-settings.component.ts (1 hunks)
  • src/app/integrations/intacct/intacct-shared/intacct-export-settings/intacct-export-settings.component.ts (1 hunks)
  • src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts (1 hunks)
  • src/app/integrations/sage300/sage300-shared/sage300-export-settings/sage300-export-settings.component.ts (1 hunks)
  • src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/app/core/models/common/export-settings.model.ts
🔇 Additional comments (4)
src/app/integrations/xero/xero-shared/xero-export-settings/xero-export-settings.component.ts (1)

113-116: Verify the intentional difference in date options handling.

The reimbursable date options are now updated unconditionally while CCC date options still have a brand check. Please confirm if this difference in handling between reimbursable and CCC date options is intentional.

Consider standardizing the behavior for both reimbursable and CCC date options to maintain consistency.

src/app/integrations/sage300/sage300-shared/sage300-export-settings/sage300-export-settings.component.ts (1)

122-123: Well-structured date options handling!

The implementation follows a clean pattern of resetting options to their default state before constructing new ones. This ensures proper state management and prevents potential option mixing issues.

Also applies to: 127-128

src/app/integrations/business-central/business-central-shared/business-central-export-settings/business-central-export-settings.component.ts (1)

162-173: Robust date options handling with validation!

The implementation includes proper validation and cleanup:

  1. Resets and constructs date options correctly
  2. Validates CCC export date values against visible options
  3. Automatically resets invalid date values

This prevents invalid states and improves user experience.

src/app/integrations/intacct/intacct-shared/intacct-export-settings/intacct-export-settings.component.ts (1)

523-524: LGTM! The removal of brand-specific check simplifies the code.

The unconditional update of reimbursable expense grouping date options makes the code more maintainable.

@ashwin1111 ashwin1111 added the deploy Triggers deployment of active branch to Staging label Jan 22, 2025
Copy link

Unit Test Coverage % values
Statements 33.02% ( 4132 / 12510 )
Branches 26.5% ( 1179 / 4448 )
Functions 25.59% ( 893 / 3489 )
Lines 33.21% ( 4066 / 12241 )

@ashwin1111 ashwin1111 merged commit a5c5d77 into master Jan 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Triggers deployment of active branch to Staging size/XL Extra Large PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants