-
Notifications
You must be signed in to change notification settings - Fork 77
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: add missing attachements on SensitivityArea APIs #3348
feat: add missing attachements on SensitivityArea APIs #3348
Conversation
Passing run #5721 ↗︎Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
Codecov ReportBase: 98.28% // Head: 98.28% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3348 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 291 292 +1
Lines 21142 21152 +10
=======================================
+ Hits 20779 20789 +10
Misses 363 363
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
Please add Prefetch in SensitiveAreaViewSet queryset (here : https://github.com/GeotrekCE/Geotrek-admin/blob/master/geotrek/api/v2/views/sensitivity.py#L35) for performances as follows
queryset = sensitivity_models.SensitiveArea.objects.existing() \
.filter(published=True) \
.select_related('species', 'structure') \
.prefetch_related('species__practices',
Prefetch('attachments',
queryset=Attachment.objects.select_related('license', 'filetype', 'filetype__structure'))) \
.alias(geom_type=GeometryType(F('geom')))
Also please add an entry to describe this PR in latest changelog https://github.com/GeotrekCE/Geotrek-admin/blob/master/docs/changelog.rst |
Changes done. There will probably be conflicts to manage with other PR I purposed due to simultaneous changes on serializers and viewsets. |
Hello @lpofredc, on a effectué quelques modifs et créé un début de guide contribution. Peux-tu rebaser sur master et repush ton code pour lancer les tests ? On va essayer de faire en sorte que tout se lance bien dans la CI pour les contributions externes Merci |
PR to fix missing attachments in SensitiveAreas APIs.
Tests updated to check if attachments are in API responses.