diff --git a/judge/views/ranked_submission.py b/judge/views/ranked_submission.py index de5933928d..472eba122a 100644 --- a/judge/views/ranked_submission.py +++ b/judge/views/ranked_submission.py @@ -70,8 +70,8 @@ def get_content_title(self): return format_html(_('Best solutions for {0}'), self.problem_name, reverse('problem_detail', args=[self.problem.code])) - def _get_result_data(self): - return get_result_data(super(RankedSubmissions, self).get_queryset().order_by()) + def _get_result_data(self, queryset=None): + return get_result_data((queryset or super(RankedSubmissions, self).get_queryset()).order_by()) class ContestRankedSubmission(ForceContestMixin, RankedSubmissions): diff --git a/judge/views/submission.py b/judge/views/submission.py index 40a3bb3374..0d640f8eed 100644 --- a/judge/views/submission.py +++ b/judge/views/submission.py @@ -215,8 +215,8 @@ def get_result_data(self): category['name'] = _(category['name']) return result - def _get_result_data(self): - return get_result_data(self.get_queryset().order_by()) + def _get_result_data(self, queryset=None): + return get_result_data((queryset or self.get_queryset()).order_by()) def access_check(self, request): pass @@ -504,15 +504,15 @@ def get_context_data(self, **kwargs): context['stats_update_interval'] = self.stats_update_interval return context - def _get_result_data(self): - if self.in_contest or self.selected_languages or self.selected_statuses: - return super(AllSubmissions, self)._get_result_data() + def _get_result_data(self, queryset=None): + if queryset or self.in_contest or self.selected_languages or self.selected_statuses: + return super(AllSubmissions, self)._get_result_data(queryset) key = 'global_submission_result_data' result = cache.get(key) if result: return result - result = super(AllSubmissions, self)._get_result_data() + result = super(AllSubmissions, self)._get_result_data(Submission.objects.all()) cache.set(key, result, self.stats_update_interval) return result