From e286f30bc8eb0a60458a1c8052d3ef9eabcf22d4 Mon Sep 17 00:00:00 2001 From: Martin Mares <mj@ucw.cz> Date: Fri, 31 Jan 2025 23:06:48 +0100 Subject: [PATCH] =?UTF-8?q?Rights:=20offer=5F*=20d=C3=A1v=C3=A1=20t=C4=9Bs?= =?UTF-8?q?n=C4=9Bj=C5=A1=C3=AD=20horn=C3=AD=20odhad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Momentálně má stenou implementaci jako can_*, jen navíc akceptuje stav "po oblastech". --- mo/rights.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mo/rights.py b/mo/rights.py index 30079566..9f3ab084 100644 --- a/mo/rights.py +++ b/mo/rights.py @@ -326,20 +326,17 @@ class RoundRights(Rights): def _is_configured(self) -> bool: return self._get_state() != db.RoundState.preparing - def _is_active(self) -> bool: - return self._get_state() not in [db.RoundState.preparing, db.RoundState.closed] - def offer_upload_solutions(self) -> bool: return (self.have_right(Right.upload_submits) and self._is_configured() - or (self.have_right(Right.upload_solutions) and self._is_active())) + or self.have_right(Right.upload_solutions) and self._get_state() in [db.RoundState.running, db.RoundState.delegate]) def offer_upload_feedback(self) -> bool: return (self.have_right(Right.upload_submits) and self._is_configured() - or (self.have_right(Right.upload_feedback) and self._is_active())) + or self.have_right(Right.upload_feedback) and self._get_state() in [db.RoundState.grading, db.RoundState.graded, db.RoundState.delegate]) def offer_edit_points(self) -> bool: - return (self.have_right(Right.manage_contest) and self._is_configured() - or (self.have_right(Right.edit_points) and self._is_active())) + return (self.have_right(Right.edit_points) and self._get_state() in [db.RoundState.grading, db.RoundState.graded, db.RoundState.delegate] + or self.have_right(Right.manage_contest) and self._is_configured()) def can_upload_solutions(self) -> bool: return (self.have_right(Right.upload_submits) and self._is_configured() -- GitLab