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, }, }