-
Notifications
You must be signed in to change notification settings - Fork 3
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 duplicated expense_groups #653
Conversation
WalkthroughThe refactor of the Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
|
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/fyle/models.py (2 hunks)
Additional comments not posted (9)
apps/fyle/models.py (9)
408-408
: Initialization offiltered_corporate_credit_card_expense_groups
.The new variable
filtered_corporate_credit_card_expense_groups
is initialized to store grouped expense data. This change is crucial for the subsequent restructuring of the logic.
444-444
: Conditional check forcorporate_credit_card_expenses
.The restructuring ensures that the grouping logic is executed only when
corporate_credit_card_expenses
is present. This prevents unnecessary operations.
445-448
: Nested condition forcorporate_credit_card_expenses_object
andsplit_expense_grouping
.The nested condition improves readability and ensures that the specific logic for handling corporate credit card expenses is executed only when both conditions are met.
449-452
: Segregation of expenses without and with bank transactions.The segregation of
ccc_expenses_without_bank_transaction
andccc_expenses_with_bank_transaction
allows for a more streamlined approach to processing these expenses.
459-463
: Grouping of expenses without bank transactions.The
_group_expenses
function is called to groupccc_expenses_without_bank_transaction
. This ensures that expenses without bank transactions are processed separately.
465-469
: Modification ofcorporate_credit_card_expense_group_field
.The modification of
corporate_credit_card_expense_group_field
to excludeexpense_number
andexpense_id
and includebank_transaction_id
ensures that the grouping logic is correctly applied based on the presence of bank transactions.
470-475
: Grouping of expenses with bank transactions.The
_group_expenses
function is called again to groupccc_expenses_with_bank_transaction
, ensuring that expenses with bank transactions are processed separately.
477-479
: Grouping of corporate credit card expenses.The
_group_expenses
function is called to groupcorporate_credit_card_expenses
when the nested condition is not met. This ensures that all corporate credit card expenses are processed.
Line range hint
481-486
:
Filtering of grouped corporate credit card expenses.The
filter_expense_groups
function is called to filterfiltered_corporate_credit_card_expense_groups
based on thecorporate_credit_card_expenses_object
. This ensures that the filtering logic is correctly applied.
|
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/fyle/models.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/fyle/models.py
expense_group_settings.split_expense_grouping == 'MULTIPLE_LINE_ITEM' | ||
): | ||
ccc_expenses_without_bank_transaction = [ | ||
expense for expense in corporate_credit_card_expenses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed expense_objects to corporate_credit_card_expenses
] | ||
|
||
ccc_expenses_with_bank_transaction = [ | ||
expense for expense in corporate_credit_card_expenses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here as well
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/fyle/models.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/fyle/models.py
|
* fix duplicated expense_groups * fix expense_objects used
Summary by CodeRabbit
Bug Fixes
Refactor