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

Set up framework for UI filters, add Performer filter #122

Merged
merged 12 commits into from
Dec 7, 2022
1 change: 1 addition & 0 deletions django/src/rdwatch/serializers/site_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SiteEvaluationListSerializer(serializers.Serializer):
count = serializers.IntegerField()
timerange = TimeRangeSerializer()
bbox = BoundingBoxSerializer()
performers = serializers.ListField()
results = SiteEvaluationSerializer(many=True)
next = serializers.CharField()
previous = serializers.CharField()
4 changes: 4 additions & 0 deletions django/src/rdwatch/views/site_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def site_evaluations(request: HttpRequest):
bbox=BoundingBox(Collect("geom")),
)

overview["performers"] = SiteEvaluation.objects.values_list(
"configuration__performer__slug", flat=True
).distinct()
Comment on lines +67 to +69
Copy link
Member Author

Choose a reason for hiding this comment

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

Note - this adds another field, "performers", to the response of this endpoint. It's a list of every performer in the system, regardless of the filters and/or pagination applied to the site evaluations themselves. I'm torn on if this is correct, or if it should be its own endpoint, but we need some way for the frontend to know every possible performer.


# Pagination
assert api_settings.PAGE_SIZE, "PAGE_SIZE must be set."
paginator = Paginator(queryset, api_settings.PAGE_SIZE)
Expand Down