From 796f135530aed3a42ef8a6301881e72c3628856e Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Tue, 1 Nov 2022 13:52:14 -0500 Subject: [PATCH] Fix bug --- judge/views/submission.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/judge/views/submission.py b/judge/views/submission.py index 13cb166..13b4651 100644 --- a/judge/views/submission.py +++ b/judge/views/submission.py @@ -812,7 +812,7 @@ class UserContestSubmissionsAjax(UserContestSubmissions): template_name = "submission/user-ajax.html" def contest_time(self, s): - if hasattr(s, "contest") and s.contest.participation.live: + if s.contest.participation.live: if self.contest.time_limit: return s.date - s.contest.participation.real_start return s.date - self.contest.start_time @@ -828,7 +828,10 @@ class UserContestSubmissionsAjax(UserContestSubmissions): ) contest_problem = self.contest.contest_problems.get(problem=self.problem) + filtered_submissions = [] for s in context["submissions"]: + if not hasattr(s, "contest"): + continue contest_time = self.contest_time(s) if contest_time: s.contest_time = nice_repr(contest_time, "noday") @@ -837,6 +840,8 @@ class UserContestSubmissionsAjax(UserContestSubmissions): points = floatformat(s.contest.points, -self.contest.points_precision) total = floatformat(contest_problem.points, -self.contest.points_precision) s.display_point = f"{points} / {total}" + filtered_submissions.append(s) + context["submissions"] = filtered_submissions return context def get(self, request, *args, **kwargs):