From ea89ee3032b6d4ae1b217fa0449348910f21ea8a Mon Sep 17 00:00:00 2001 From: Tony Thomas <01tonythomas@gmail.com> Date: Sun, 14 Oct 2018 11:28:12 +0200 Subject: [PATCH] fix(#26) No more results with no prev results --- dashboard/core/bots/reports/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dashboard/core/bots/reports/views.py b/dashboard/core/bots/reports/views.py index e273977..ef21e3e 100644 --- a/dashboard/core/bots/reports/views.py +++ b/dashboard/core/bots/reports/views.py @@ -79,7 +79,7 @@ def build_filters(self, is_improvement=True) -> dict: 'root_test__in': tests, 'bot__in': bot, 'browser__in': browsers, - 'is_improvement': is_improvement + 'is_improvement': is_improvement, } @@ -91,7 +91,8 @@ def get_queryset(self): queryset = super(BotDataReportImprovementListView, self).get_queryset() filter_params = self.build_filters(is_improvement=True) limit = int(self.kwargs.get('limit', 10)) - return queryset.filter(**filter_params).order_by('-delta')[:limit] + return queryset.filter(**filter_params).exclude( + prev_result__isnull=True).order_by('-delta')[:limit] class BotDataReportRegressionListView(ReportDataBaseListViewSerializer): @@ -102,7 +103,8 @@ def get_queryset(self): queryset = super(BotDataReportRegressionListView, self).get_queryset() filter_params = self.build_filters(is_improvement=False) limit = int(self.kwargs.get('limit', 10)) - return queryset.filter(**filter_params).order_by('-delta')[:limit] + return queryset.filter(**filter_params).exclude( + prev_result__isnull=True).order_by('-delta')[:limit] class TestPathList(ListAPIView):