From 0650223d1040affc6270f93e948521885e4069ec Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Wed, 28 Dec 2022 14:59:15 -0600 Subject: [PATCH] Fix contest display on home --- judge/models/contest.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/judge/models/contest.py b/judge/models/contest.py index 8c180bc..a225012 100644 --- a/judge/models/contest.py +++ b/judge/models/contest.py @@ -546,7 +546,7 @@ class Contest(models.Model): @classmethod def get_visible_contests(cls, user, show_own_contests_only=False): - if not user.is_authenticated or show_own_contests_only: + if not user.is_authenticated: return ( cls.objects.filter( is_visible=True, is_organization_private=False, is_private=False @@ -556,9 +556,12 @@ class Contest(models.Model): ) queryset = cls.objects.defer("description") - if not ( - user.has_perm("judge.see_private_contest") - or user.has_perm("judge.edit_all_contest") + if ( + not ( + user.has_perm("judge.see_private_contest") + or user.has_perm("judge.edit_all_contest") + ) + or show_own_contests_only ): q = Q(is_visible=True) q &= (