This commit is contained in:
cuom1999 2022-11-01 13:52:14 -05:00
parent 58486846c1
commit 796f135530

View file

@ -812,7 +812,7 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
template_name = "submission/user-ajax.html" template_name = "submission/user-ajax.html"
def contest_time(self, s): def contest_time(self, s):
if hasattr(s, "contest") and s.contest.participation.live: if s.contest.participation.live:
if self.contest.time_limit: if self.contest.time_limit:
return s.date - s.contest.participation.real_start return s.date - s.contest.participation.real_start
return s.date - self.contest.start_time return s.date - self.contest.start_time
@ -828,7 +828,10 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
) )
contest_problem = self.contest.contest_problems.get(problem=self.problem) contest_problem = self.contest.contest_problems.get(problem=self.problem)
filtered_submissions = []
for s in context["submissions"]: for s in context["submissions"]:
if not hasattr(s, "contest"):
continue
contest_time = self.contest_time(s) contest_time = self.contest_time(s)
if contest_time: if contest_time:
s.contest_time = nice_repr(contest_time, "noday") s.contest_time = nice_repr(contest_time, "noday")
@ -837,6 +840,8 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
points = floatformat(s.contest.points, -self.contest.points_precision) points = floatformat(s.contest.points, -self.contest.points_precision)
total = floatformat(contest_problem.points, -self.contest.points_precision) total = floatformat(contest_problem.points, -self.contest.points_precision)
s.display_point = f"{points} / {total}" s.display_point = f"{points} / {total}"
filtered_submissions.append(s)
context["submissions"] = filtered_submissions
return context return context
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):