-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[GSoC2024] - fixed attribute rename issue #7670
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #7670 +/- ##
========================================
Coverage 83.44% 83.44%
========================================
Files 373 373
Lines 39724 39733 +9
Branches 3741 3741
========================================
+ Hits 33147 33156 +9
Misses 6577 6577
|
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.
Hello @ritikraj26, thank you for the contribution! We really appreciate your efforts. However, could you please consider implementing a slightly different approach?
Add a new id
field to AttributeSerializer
:
class AttributeSerializer(serializers.ModelSerializer):
id = serializers.IntegerField(required=False)
...
In that case, you don't need to add explicitly id
field into AttributeSpec
model and create a new migration. Moreover, the attribute id will be available here (since each item of label.attributespec_set
will include id) and you don't need to pass initial_data
and "reinvent the wheel" on how to define attribute id.
Also, could you please add tests for checking that the renaming attributes functionality works as expected?
Sure I will add the tests for checking this functionality. |
Do I need to add the tests in test_labels.py or create a separate test_attributes.py? |
Yes, there is no need to create a separate test file, you can extend TestPatchLabels from test_labels.py |
I will have to modify the payload here to adjust the expected output. |
It seems to be working fine now. I had to clear the pytest cache. |
@Marishka17 @nmanovic |
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.
Probably it will be better to consider submitting a separate PR with REST API tests, to speed up the merging of this PR.
Also, could you please create a changelog fragment? (scriv create --edit
)
I removed the rest-api tests from this PR. I will add them in a separate PR. |
changelog.d/20240410_095637_ritikraj2699_attribute_rename_fix.md
Outdated
Show resolved
Hide resolved
@ritikraj26, I see that tests are failing now. Could you please update the server schema? (Run the command |
Done |
c0ede42
to
daa931c
Compare
@ritikraj26, Looks like you forgot to commit changes (there are still no changes in the |
I pushed it. Could you check again? |
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.
LGTM
@ritikraj26, Thank you for the contribution! |
Added rest-api tests for attribute rename feature. These rest-api tests are to validate the changes introduced in the PR [here](#7670) --------- Co-authored-by: Maria Khrustaleva <maria@cvat.ai>
Motivation and context
This PR fixes two open issues
Used attribute id to fetch attribute from the database and renamed it from the list received in the request.
How has this been tested?
Tested it under multiple scenarios, like different attribute types, input values, and labels.
Checklist
develop
branch- [ ] I have updated the documentation accordingly- [ ] I have increased versions of npm packages if it is necessary(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.