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 Account Sync #114

Merged
merged 1 commit into from
May 14, 2024
Merged

Fix Account Sync #114

merged 1 commit into from
May 14, 2024

Conversation

ruuushhh
Copy link
Contributor

@ruuushhh ruuushhh commented May 14, 2024

Summary by CodeRabbit

  • Bug Fixes
    • Improved data synchronization logic to ensure more accurate processing of account types and direct posting conditions.

@ruuushhh ruuushhh self-assigned this May 14, 2024
@ruuushhh ruuushhh temporarily deployed to CI Environment May 14, 2024 10:39 — with GitHub Actions Inactive
Copy link

coderabbitai bot commented May 14, 2024

Walkthrough

The _sync_data function in the business_central app's utils.py file has been refined. The update enhances the condition that checks the item dictionary's accountType and directPosting keys. Now, the function proceeds only if accountType is not 'Posting' and directPosting is either not present or evaluates to False.

Changes

File Change Summary
apps/business_central/utils.py Updated _sync_data function to include an additional check for the directPosting key in item.

In the code where business thrives,
A change to help the data jive.
With checks for posting, direct or not,
Efficiency is what we've now got.
The rabbits cheer, their hearts alight,
For code that's clean and functions 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 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 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 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.

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

@ruuushhh ruuushhh temporarily deployed to CI Environment May 14, 2024 10:39 — with GitHub Actions Inactive
@ruuushhh ruuushhh added the deploy deploy to staging environment label May 14, 2024
@ruuushhh ruuushhh temporarily deployed to CI Environment May 14, 2024 10:40 — with GitHub Actions Inactive
Copy link

Tests Skipped Failures Errors Time
118 0 💤 0 ❌ 0 🔥 7.827s ⏱️

Copy link

Tests Skipped Failures Errors Time
118 0 💤 0 ❌ 0 🔥 8.840s ⏱️

Copy link

Tests Skipped Failures Errors Time
118 0 💤 0 ❌ 0 🔥 8.156s ⏱️

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.

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 5997a8c and c979d2e.
Files selected for processing (1)
  • apps/business_central/utils.py (1 hunks)
Additional Context Used
Ruff (1)
apps/business_central/utils.py (1)

74-74: Avoid inequality comparisons to True; use if not item.get('blocked'): for false checks

Additional comments not posted (1)
apps/business_central/utils.py (1)

79-79: Ensure the new condition for directPosting is correct and necessary.

The added condition or not item.get('directPosting') ensures that accounts with directPosting set to False are skipped. Verify that this aligns with the intended business logic.

@@ -76,7 +76,7 @@ def _sync_data(self, data, attribute_type, display_name, workspace_id, field_nam
else:
active = False
if attribute_type == 'ACCOUNT':
if item.get('accountType') != 'Posting':
if item.get('accountType') != 'Posting' or not item.get('directPosting'):
Copy link

Choose a reason for hiding this comment

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

Avoid inequality comparisons to True; use if not item.get('blocked'): for false checks.

- if (attribute_type == 'EMPLOYEE' and item.get('status') == 'Active') or (attribute_type in ('LOCATION', 'COMPANY')) or (item.get('blocked') is not None and item.get('blocked') != True):
+ if (attribute_type == 'EMPLOYEE' and item.get('status') == 'Active') or (attribute_type in ('LOCATION', 'COMPANY')) or (item.get('blocked') is not None and not item.get('blocked')):

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.

Suggested change
if item.get('accountType') != 'Posting' or not item.get('directPosting'):
if item.get('accountType') != 'Posting' or not item.get('directPosting'):

@ruuushhh ruuushhh merged commit 141791c into master May 14, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy deploy to staging environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants