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

upate workspace last synced fix #320

Merged
merged 1 commit into from
Mar 6, 2024
Merged

upate workspace last synced fix #320

merged 1 commit into from
Mar 6, 2024

Conversation

ruuushhh
Copy link
Contributor

@ruuushhh ruuushhh commented Mar 6, 2024

Summary by CodeRabbit

  • Refactor
    • Simplified code imports and enhanced conditional checks for workspace synchronization.

@ruuushhh ruuushhh requested a review from ashwin1111 March 6, 2024 06:54
@ruuushhh ruuushhh self-assigned this Mar 6, 2024
@ruuushhh ruuushhh temporarily deployed to CI Environment March 6, 2024 06:54 — with GitHub Actions Inactive
@ruuushhh ruuushhh temporarily deployed to CI Environment March 6, 2024 06:54 — with GitHub Actions Inactive
Copy link

coderabbitai bot commented Mar 6, 2024

Walkthrough

The recent update streamlines the codebase by refining import statements and enhancing conditional logic related to synchronization timestamps. These adjustments aim to improve efficiency and clarity, ensuring that the application remains responsive and up-to-date with the latest data.

Changes

Files Change Summary
apps/.../tasks.py Simplified imports and updated conditional checks for workspace.last_synced_at and workspace.ccc_last_synced_at.

🐇✨
In the code's warren, deep and wide,
A rabbit hopped with agile stride.
Imports neat, conditions keen,
In every line, improvement seen.
With each sync, and every byte,
Our code now dances light and right.
🌟🐾

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@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.

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 386b917 and 5c10d3a.
Files selected for processing (1)
  • apps/fyle/tasks.py (3 hunks)

@@ -103,7 +101,7 @@ def async_create_expense_groups(
)
)

if expenses:
if workspace.last_synced_at or expenses:
Copy link

Choose a reason for hiding this comment

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

The logic for updating workspace.last_synced_at is now based on whether this timestamp is already set or if there are any expenses. This change ensures that the timestamp is updated to the current time if either condition is met. However, it's important to ensure that this logic aligns with the intended behavior for all scenarios where expenses might be processed. Consider adding a comment explaining the rationale behind this condition to aid future maintainers.

@@ -126,7 +124,7 @@ def async_create_expense_groups(
)
)

if len(expenses) != reimbursable_expenses_count:
if workspace.ccc_last_synced_at or len(expenses) != reimbursable_expenses_count:
Copy link

Choose a reason for hiding this comment

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

Similar to the previous comment, the update to workspace.ccc_last_synced_at is now contingent upon the timestamp being set or the number of expenses differing from the count of reimbursable expenses. This adjustment seems to target a more accurate update mechanism for credit card transactions. As with the previous suggestion, adding explanatory comments could enhance maintainability.

Comment on lines 4 to 11
from typing import Dict, List

from django.db import transaction
from fyle.platform.exceptions import (
InvalidTokenError as FyleInvalidTokenError,
RetryException,
)
from fyle.platform.exceptions import InvalidTokenError as FyleInvalidTokenError
from fyle.platform.exceptions import RetryException
from fyle_integrations_platform_connector import PlatformConnector

from apps.fyle.actions import create_generator_and_post_in_batches
Copy link

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [143-143]

Logging sensitive information, such as workspace IDs, could potentially expose them in logs which might not be secure. While the logged message "Fyle credentials not found %s" is not directly logging sensitive information, it's a good practice to review what is being logged and ensure that no sensitive data is inadvertently exposed. Consider revising the logging strategy to minimize the risk of exposing sensitive information.

- logger.info("Fyle credentials not found %s", workspace_id)
+ logger.info("Fyle credentials not found for workspace ID: [REDACTED]")

Copy link

github-actions bot commented Mar 6, 2024

Tests Skipped Failures Errors Time
160 0 💤 0 ❌ 0 🔥 1m 4s ⏱️

1 similar comment
Copy link

github-actions bot commented Mar 6, 2024

Tests Skipped Failures Errors Time
160 0 💤 0 ❌ 0 🔥 1m 4s ⏱️

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.54%. Comparing base (386b917) to head (5c10d3a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #320   +/-   ##
=======================================
  Coverage   94.53%   94.54%           
=======================================
  Files          60       60           
  Lines        3626     3627    +1     
=======================================
+ Hits         3428     3429    +1     
  Misses        198      198           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ruuushhh ruuushhh merged commit 60ccb7e into master Mar 6, 2024
4 checks passed
Hrishabh17 pushed a commit that referenced this pull request Mar 8, 2024
Hrishabh17 added a commit that referenced this pull request Mar 12, 2024
* Added integrations_imports submodule, made changes in settings (#310)

* Refactor imports for Project resource (#311)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Refactor imports for project and cost_center (#314)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Refactor imports costcenter (#312)

* Resource Cost_Center: refactored imports

* Refactor imports for Project resource (#311)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Refactor imports custom expense (#313)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Resource Tax Group: refactored imports (#315)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Resource Tax Group: refactored imports

* Resource Tax Group: changed to is_auto_sync to False by default

* Resource Category: refactored imports (#316)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Tax Group: refactored imports

* Resource Category: refactored imports

* Resource Category: changed is_auto_sync_enabled to True by default

* Refactor imports supplier (#318)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Tax Group: refactored imports

* Resource Category: refactored imports

* Added RetryException handler and bumped the sdk versions (#306)

* Set tasks limit to 1L (#317)

* Set tasks limit to 1L

* set timeout

* Modified the import schedule creation condition

---------

Co-authored-by: ruuushhh <[email protected]>

* Refactor old flow (#321)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Tax Group: refactored imports

* Resource Category: refactored imports

* Added RetryException handler and bumped the sdk versions (#306)

* Set tasks limit to 1L (#317)

* Set tasks limit to 1L

* set timeout

* Modified the import schedule creation condition

* Removed dead code, add few test cases, added script for adding new schedule for different workspaces

* Added post deploy sql script to dump old schedules and delete

---------

Co-authored-by: ruuushhh <[email protected]>

* Merged changes from master

* Update delete workspace func (#319)

* Update delete workspace func

* Fix comments

* upate workspace last synced fix (#320)

* Modified the workflow for submodule

* Decreased the coverage to 88%

---------

Co-authored-by: ruuushhh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants