From a5df36c4767ee955a279e5875db27a8939e6ef4a Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 15 Feb 2023 16:36:33 -0600 Subject: [PATCH] Optimize submission page --- judge/views/submission.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/judge/views/submission.py b/judge/views/submission.py index 83e5808..ac33ff9 100644 --- a/judge/views/submission.py +++ b/judge/views/submission.py @@ -404,10 +404,11 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView): language__in=Language.objects.filter(key__in=self.selected_languages) ) if self.selected_statuses: - queryset = queryset.filter( - Q(result__in=self.selected_statuses) - | Q(status__in=self.selected_statuses) - ) + submission_results = [i for i, _ in Submission.RESULT] + if self.selected_statuses[0] in submission_results: + queryset = queryset.filter(result__in=self.selected_statuses) + else: + queryset = queryset.filter(status__in=self.selected_statuses) return queryset @@ -521,8 +522,8 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView): if check is not None: return check - self.selected_languages = set(request.GET.getlist("language")) - self.selected_statuses = set(request.GET.getlist("status")) + self.selected_languages = request.GET.getlist("language") + self.selected_statuses = request.GET.getlist("status") if self.in_contest and self.contest.is_editable_by(self.request.user): self.include_frozen = True @@ -816,15 +817,14 @@ class AllSubmissions(GeneralSubmissions): return context def _get_result_data(self): - if ( - self.request.organization - or self.in_contest - or self.selected_languages - or self.selected_statuses - ): + if self.request.organization or self.in_contest: return super(AllSubmissions, self)._get_result_data() key = "global_submission_result_data" + if self.selected_statuses: + key += ":" + ",".join(self.selected_statuses) + if self.selected_languages: + key += ":" + ",".join(self.selected_languages) result = cache.get(key) if result: return result