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

Study filter for exports #1082

Merged
merged 4 commits into from
Aug 28, 2024
Merged

Study filter for exports #1082

merged 4 commits into from
Aug 28, 2024

Conversation

munnsmunns
Copy link
Collaborator

@munnsmunns munnsmunns commented Aug 14, 2024

Add a filter for the animal and epiv2 full exports to limit results to specific study ids using the study_ids param.

Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my change below - I modified so it could support "bad" requests

@@ -29,7 +29,11 @@ class AnimalAssessmentViewSet(BaseAssessmentViewSet):

def get_endpoint_queryset(self, request):
published_only = get_published_only(self.assessment, request)
return models.Endpoint.objects.get_qs(self.assessment).published_only(published_only)
study_ids = [int(study_id) for study_id in self.request.query_params.get("study_ids", [])]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would fail with a 500 error if the value couldn't be cast to an int. I changed to:

study_ids = try_parse_list_ints(request.query_params.get("study_ids"))

@shapiromatron shapiromatron merged commit 2ab502d into main Aug 28, 2024
6 checks passed
@shapiromatron shapiromatron deleted the export-study-filter branch August 28, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants