From 42ce5f60e648b33d227fba75dd1b46f220a05bd5 Mon Sep 17 00:00:00 2001 From: juuso-j <68938778+juuso-j@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:17:26 +0300 Subject: [PATCH] Filter is_test=False Serialize only if event area is not for testing purposes --- parkings/api/public/event_area_total_statistics.py | 2 +- parkings/models/event_area.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parkings/api/public/event_area_total_statistics.py b/parkings/api/public/event_area_total_statistics.py index faef26ff..ca05dfbb 100644 --- a/parkings/api/public/event_area_total_statistics.py +++ b/parkings/api/public/event_area_total_statistics.py @@ -25,4 +25,4 @@ class PublicAPIEventAreaTotalStatisticsViewSet(viewsets.ReadOnlyModelViewSet): permission_classes = [permissions.AllowAny] serializer_class = EventAreaTotalStatisticsSerializer pagination_class = Pagination - queryset = EventAreaStatistics.objects.all().order_by('-created_at') + queryset = EventAreaStatistics.objects.filter(event_area__is_test=False).order_by('-created_at') diff --git a/parkings/models/event_area.py b/parkings/models/event_area.py index 6164bdcf..36c45331 100644 --- a/parkings/models/event_area.py +++ b/parkings/models/event_area.py @@ -26,7 +26,7 @@ def get_active_queryset(self): Q(time_period_time_end__gte=now) & Q(time_period_time_start__lte=now) & Q( time_period_days_of_week__contains=[iso_weekday]) ) - return qs.order_by('origin_id') + return qs.filter(is_test=False).order_by('origin_id') class EventArea(AbstractParkingArea):