From ad278f58a904dc07755bb9423b38fdee43cbee53 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sun, 17 Sep 2023 00:44:07 -0500 Subject: [PATCH] Make public scoreboard better --- judge/views/contests.py | 5 +++++ templates/contest/contest-tabs.html | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/judge/views/contests.py b/judge/views/contests.py index 1e60388..97ff251 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -278,6 +278,10 @@ class ContestMixin(object): def can_edit(self): return self.object.is_editable_by(self.request.user) + @cached_property + def can_access(self): + return self.object.is_accessible_by(self.request.user) + def should_bypass_access_check(self, contest): return False @@ -304,6 +308,7 @@ class ContestMixin(object): context["is_editor"] = self.is_editor context["is_tester"] = self.is_tester context["can_edit"] = self.can_edit + context["can_access"] = self.can_access if not self.object.og_image or not self.object.summary: metadata = generate_opengraph( diff --git a/templates/contest/contest-tabs.html b/templates/contest/contest-tabs.html index b01137b..9baa4cc 100644 --- a/templates/contest/contest-tabs.html +++ b/templates/contest/contest-tabs.html @@ -7,15 +7,17 @@ }