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: make db changes and fixture updates to support split expenses #680

Conversation

JustARatherRidiculouslyLongUsername
Copy link
Contributor

@JustARatherRidiculouslyLongUsername JustARatherRidiculouslyLongUsername commented Nov 25, 2024

Clickup

https://app.clickup.com/t/86cx0vh5m

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced bank_transaction_id and split_expense_grouping fields in expense-related models to enhance transaction tracking and grouping capabilities.
    • Enhanced credit card charge handling to support multiple line items, improving processing flexibility.
  • Bug Fixes

    • Improved error handling for vendor payments and credit card charge processing.
  • Documentation

    • Updated serializers to include the new split_expense_grouping field.
  • Tests

    • Expanded test coverage to validate new functionality for handling multiple line items and tax calculations.

…ings (#672)

* feat: support GET and PUT for `split_expense_grouping` in export settings

* feat: implement split expense grouping functionality (#675)

* feat: implement split expense grouping functionality

* feat: add script for split expense grouping (#676)

* feat: add script for split expense grouping

Set the default split expense grouping config to SINGLE_LINE_ITEM for all old orgs

* test: add missing fixtures

* feat: support multiple line items for CC charge exports (#677)

* feat: support multiple line items for CC charge exports

* test: update tests to account for the new function signature

* test: update tests and fixtures

Account for tax balancing and credit card charge lineitems changes

* refactor: move url out of `for` loop
Copy link

coderabbitai bot commented Nov 25, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces significant changes to the Django application, primarily adding new fields to existing models related to expenses and credit card charges. Specifically, the expense model receives a bank_transaction_id field, while the expensegroupsettings model gains a split_expense_grouping field. The changes extend to various methods across multiple files, enhancing the handling of credit card charges to support multiple line items. Additionally, updates to serializers and database scripts ensure that these new fields are integrated into the overall application structure.

Changes

File Path Change Summary
apps/fyle/migrations/0035_support_split_expense_grouping.py Added bank_transaction_id to expense model and split_expense_grouping to expensegroupsettings model, establishing migration dependencies.
apps/fyle/models.py Added bank_transaction_id to Expense model and split_expense_grouping to ExpenseGroupSettings model, updated methods to accommodate new fields, and introduced a static method for default grouping.
apps/netsuite/connector.py Updated methods to handle multiple CreditCardChargeLineItem objects, enhancing flexibility in credit card charge processing.
apps/netsuite/models.py Renamed create_credit_card_charge_lineitem to create_credit_card_charge_lineitems to process multiple line items, and adjusted logic accordingly.
apps/netsuite/tasks.py Updated create_credit_card_charge and create_vendor_payment methods to reflect handling of multiple line items and improved error handling and logging.
apps/workspaces/apis/export_settings/serializers.py Added split_expense_grouping as a required field in ExpenseGroupSettingsSerializer.
scripts/sql/scripts/030-default-split-expense-grouping-for-old-orgs.sql Introduced a SQL script to update expense_group_settings with a default value for split_expense_grouping.
tests/test_fyle/fixtures.py Added bank_transaction_id and split_expense_grouping fields to various expense entries in test fixtures.
tests/test_netsuite/conftest.py Updated fixture for credit card charge line items to reflect plural method name change.
tests/test_netsuite/test_connector.py Renamed variables in tests to accommodate multiple credit card charge line items, enhancing test coverage.
tests/test_netsuite/test_models.py Refactored tests to align with new method signatures for handling multiple credit card charge line items.
tests/test_workspaces/test_apis/test_export_settings/fixtures.py Added split_expense_grouping to export settings in test fixtures.

Possibly related PRs

Suggested labels

size/XL, deploy

Suggested reviewers

  • ruuushhh
  • ashwin1111

🐰 In fields of green, where expenses bloom,
New fields arise, dispelling the gloom.
With transactions linked, and charges in line,
Our code hops forward, in rhythm and rhyme.
So let’s cheer for changes, both big and small,
For a brighter tomorrow, we’ll conquer it all! 🌼

Warning

Rate limit exceeded

@github-actions[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 55 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 6a50afe and 33a5a88.


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.

@github-actions github-actions bot added the size/L Large PR label Nov 25, 2024
Copy link

Tests Skipped Failures Errors Time
232 0 💤 0 ❌ 0 🔥 26.144s ⏱️

@JustARatherRidiculouslyLongUsername JustARatherRidiculouslyLongUsername merged commit a576ed4 into ut-split-expense-grouping Nov 25, 2024
3 checks passed
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 94.20290% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (ut-split-expense-grouping@6a50afe). Learn more about missing BASE report.

Files with missing lines Patch % Lines
apps/netsuite/models.py 88.57% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                     Coverage Diff                      @@
##             ut-split-expense-grouping     #680   +/-   ##
============================================================
  Coverage                             ?   88.35%           
============================================================
  Files                                ?       59           
  Lines                                ?     5524           
  Branches                             ?        0           
============================================================
  Hits                                 ?     4881           
  Misses                               ?      643           
  Partials                             ?        0           
Files with missing lines Coverage Δ
apps/fyle/models.py 96.23% <100.00%> (ø)
apps/netsuite/connector.py 87.90% <100.00%> (ø)
apps/netsuite/tasks.py 84.72% <100.00%> (ø)
...pps/workspaces/apis/export_settings/serializers.py 96.47% <100.00%> (ø)
apps/netsuite/models.py 96.19% <88.57%> (ø)
---- 🚨 Try these New Features:

JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Nov 25, 2024
)

* test: write unit tests and add fixtures for split expense grouping

* refactor: remove duplicate bank txn IDs

* test: fix failing tests

* feat: make db changes and fixture updates to support split expenses (#680)

* feat: make db changes and fixture updates to support split expenses

* feat: support GET and PUT for `split_expense_grouping` in export settings (#672)

* feat: support GET and PUT for `split_expense_grouping` in export settings

* feat: implement split expense grouping functionality (#675)

* feat: implement split expense grouping functionality

* feat: add script for split expense grouping (#676)

* feat: add script for split expense grouping

Set the default split expense grouping config to SINGLE_LINE_ITEM for all old orgs

* test: add missing fixtures

* feat: support multiple line items for CC charge exports (#677)

* feat: support multiple line items for CC charge exports

* test: update tests to account for the new function signature

* test: update tests and fixtures

Account for tax balancing and credit card charge lineitems changes

* refactor: move url out of `for` loop
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Nov 25, 2024
* test: write unit tests and add fixtures for split expense grouping (#670)

* test: write unit tests and add fixtures for split expense grouping

* refactor: remove duplicate bank txn IDs

* test: fix failing tests

* feat: make db changes and fixture updates to support split expenses (#680)

* feat: make db changes and fixture updates to support split expenses

* feat: support GET and PUT for `split_expense_grouping` in export settings (#672)

* feat: support GET and PUT for `split_expense_grouping` in export settings

* feat: implement split expense grouping functionality (#675)

* feat: implement split expense grouping functionality

* feat: add script for split expense grouping (#676)

* feat: add script for split expense grouping

Set the default split expense grouping config to SINGLE_LINE_ITEM for all old orgs

* test: add missing fixtures

* feat: support multiple line items for CC charge exports (#677)

* feat: support multiple line items for CC charge exports

* test: update tests to account for the new function signature

* test: update tests and fixtures

Account for tax balancing and credit card charge lineitems changes

* refactor: move url out of `for` loop
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Nov 26, 2024
* test: write unit tests and add fixtures for split expense grouping (#670)

* test: write unit tests and add fixtures for split expense grouping

* refactor: remove duplicate bank txn IDs

* test: fix failing tests

* feat: make db changes and fixture updates to support split expenses (#680)

* feat: make db changes and fixture updates to support split expenses

* feat: support GET and PUT for `split_expense_grouping` in export settings (#672)

* feat: support GET and PUT for `split_expense_grouping` in export settings

* feat: implement split expense grouping functionality (#675)

* feat: implement split expense grouping functionality

* feat: add script for split expense grouping (#676)

* feat: add script for split expense grouping

Set the default split expense grouping config to SINGLE_LINE_ITEM for all old orgs

* test: add missing fixtures

* feat: support multiple line items for CC charge exports (#677)

* feat: support multiple line items for CC charge exports

* test: update tests to account for the new function signature

* test: update tests and fixtures

Account for tax balancing and credit card charge lineitems changes

* refactor: move url out of `for` loop

(cherry picked from commit c0309e8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Large PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant