From 70487cf6f6144cca040c05f9299847432f568035 Mon Sep 17 00:00:00 2001 From: Keenan Gugeler Date: Mon, 21 Feb 2022 13:58:29 -0500 Subject: [PATCH] allow users to see own participation after window To provide a better UX, especially for fully-hidden contests, contestants can now see their own participation after they have completed the contest. --- judge/models/contest.py | 2 +- judge/models/tests/test_contest.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/judge/models/contest.py b/judge/models/contest.py index 126ae157c4..49c25e5aa8 100644 --- a/judge/models/contest.py +++ b/judge/models/contest.py @@ -203,7 +203,7 @@ def can_see_own_scoreboard(self, user): return True if not self.can_join: return False - if not self.show_scoreboard and not self.is_in_contest(user): + if not self.show_scoreboard and not self.is_in_contest(user) and not self.has_completed_contest(user): return False return True diff --git a/judge/models/tests/test_contest.py b/judge/models/tests/test_contest.py index 3c571a28ce..dd357843d9 100644 --- a/judge/models/tests/test_contest.py +++ b/judge/models/tests/test_contest.py @@ -391,7 +391,7 @@ def test_contest_hidden_scoreboard_contest_methods(self): 'has_completed_contest': self.assertFalse, }, 'normal_after_window': { - 'can_see_own_scoreboard': self.assertFalse, + 'can_see_own_scoreboard': self.assertTrue, 'can_see_full_scoreboard': self.assertFalse, 'has_completed_contest': self.assertTrue, }, @@ -461,24 +461,31 @@ def test_visible_scoreboard_contest_methods(self): def test_full_hidden_scoreboard_contest_methods(self): data = { 'superuser': { + 'can_see_own_scoreboard': self.assertTrue, 'can_see_full_scoreboard': self.assertTrue, }, 'non_staff_tester': { + 'can_see_own_scoreboard': self.assertFalse, 'can_see_full_scoreboard': self.assertFalse, }, 'non_staff_author': { + 'can_see_own_scoreboard': self.assertTrue, 'can_see_full_scoreboard': self.assertTrue, }, 'staff_contest_edit_own': { + 'can_see_own_scoreboard': self.assertTrue, 'can_see_full_scoreboard': self.assertTrue, }, 'staff_contest_edit_all': { + 'can_see_own_scoreboard': self.assertTrue, 'can_see_full_scoreboard': self.assertTrue, }, 'normal': { + 'can_see_own_scoreboard': self.assertFalse, 'can_see_full_scoreboard': self.assertFalse, }, 'normal_after_window': { + 'can_see_own_scoreboard': self.assertTrue, 'can_see_full_scoreboard': self.assertFalse, }, }