-
Notifications
You must be signed in to change notification settings - Fork 0
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: Updating the same QBD Mapping in case of name case change #74
Conversation
WalkthroughThe recent updates focus on refining the functionality and user experience within a mapping application. Key improvements include correcting the logic for filtering Changes
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 Configration 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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (4)
- apps/mappings/actions.py (1 hunks)
- apps/mappings/connector.py (2 hunks)
- apps/mappings/migrations/0002_auto_20240318_0616.py (1 hunks)
- apps/mappings/models.py (2 hunks)
Files skipped from review due to trivial changes (1)
- apps/mappings/connector.py
Additional comments: 3
apps/mappings/migrations/0002_auto_20240318_0616.py (1)
- 13-17: The migration operation correctly alters the
source_id
field to have amax_length
of 255 and beunique
, aligning with the PR objectives. However, ensure that existing data in the database does not contain duplicatesource_id
values, as this could lead to migration issues.apps/mappings/models.py (2)
- 13-13: The update to the
source_id
field, making it unique and updating thehelp_text
, aligns with the PR objectives and enhances data integrity by ensuring that eachsource_id
is unique.- 27-31: The adjustments in the
update_or_create_mapping_objects
method correctly map values forsource_id
andsource_value
fromqbd_mapping_object
, ensuring accurate mapping object creation or updates. This aligns with the PR objectives and enhances the reliability of QBD mappings.
total_attributes_count = QBDMapping.objects.filter( | ||
workspace_id=workspace_id, | ||
attribute_type = source_type).count() | ||
attribute_type = source_type |
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.
The filtering conditions have been correctly updated to accurately count total and unmapped attributes based on attribute_type
and destination_value
. However, for consistency and adherence to PEP 8 style guidelines, consider adjusting the spacing around the equals sign in the filter conditions.
- attribute_type = source_type
+ attribute_type=source_type
- destination_value__isnull=True
+ destination_value__isnull=True
Also applies to: 16-16
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.
attribute_type = source_type | |
attribute_type=source_type |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #74 +/- ##
==========================================
- Coverage 99.24% 99.01% -0.24%
==========================================
Files 48 48
Lines 2126 2128 +2
==========================================
- Hits 2110 2107 -3
- Misses 16 21 +5
|
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (8)
- apps/mappings/serializers.py (1 hunks)
- apps/mappings/views.py (1 hunks)
- tests/conftest.py (1 hunks)
- tests/test_fyle/test_view.py (2 hunks)
- tests/test_mapping/fixtures.py (3 hunks)
- tests/test_mapping/test_connector.py (2 hunks)
- tests/test_mapping/test_view.py (5 hunks)
- tests/test_qbd/test_tasks.py (5 hunks)
Files skipped from review due to trivial changes (2)
- tests/test_mapping/fixtures.py
- tests/test_qbd/test_tasks.py
Additional comments: 12
apps/mappings/serializers.py (1)
- 11-14: Removing all validators from the
source_id
field could potentially lead to issues if there are specific constraints onsource_id
that should be enforced. Please verify the intention behind this change and consider adding custom validators if necessary.tests/test_mapping/test_connector.py (2)
- 4-4: The correction of the import statement from
fixture
tofixtures
improves code consistency. Ensure the renamed file exists and is correctly referenced.- 20-22: Adjusting the key case in the fixture dictionary for consistency is good practice. Ensure that all references to these keys have been updated to match the new case.
tests/test_fyle/test_view.py (2)
- 6-6: The correction of the import statement from
fixture
tofixtures
improves code consistency. Ensure the renamed file exists and is correctly referenced.- 34-35: Adjusting the key case in the fixture dictionary for consistency is good practice. Ensure that all references to these keys have been updated to match the new case.
apps/mappings/views.py (2)
- 27-27: Renaming the class to
QBDMappingStatsView
better reflects its functionality. Ensure that all references to the old class name have been updated to avoid breaking changes.- 27-27: Correcting the comment for readability is a good practice. This minor change improves the clarity of the code documentation.
tests/test_mapping/test_view.py (4)
- 6-6: The correction of the import statement from
fixture
tofixtures
improves code consistency. Ensure the renamed file exists and is correctly referenced.- 31-32: Adjusting the key case in the fixture dictionary for consistency is good practice. Ensure that all references to these keys have been updated to match the new case.
- 31-32: Updating test assertions to match the adjusted fixture keys is necessary to maintain test validity. Ensure a thorough review of all tests has been conducted to ensure consistency.
Also applies to: 64-66, 74-76, 101-102
- 54-54: Consider removing the print statement or replacing it with a logging statement for better control over output in test environments.
tests/conftest.py (1)
- 25-25: The correction of the import path from
test_mapping.fixture
totest_mapping.fixtures
improves code consistency. Ensure the renamed file exists and is correctly referenced.
} | ||
|
||
def create(self, validated_data): | ||
workspace_id = self.context['request'].parser_context.get('kwargs').get('workspace_id') | ||
|
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.
The changes to dynamically obtain workspace_id
from the request context are good. However, consider adding error handling to ensure workspace_id
is always present in the context to avoid potential KeyError
or NoneType
errors.
Summary by CodeRabbit
Bug Fixes
source_id
field in the mapping model for better data integrity and uniqueness.Refactor
Database Changes
source_id
field in theQbdMapping
model to enhance data model constraints.