Skip to content
Snippets Groups Projects
Commit e286f30b authored by Martin Mareš's avatar Martin Mareš
Browse files

Rights: offer_* dává těsnější horní odhad

Momentálně má stenou implementaci jako can_*, jen navíc akceptuje
stav "po oblastech".
parent 03feae7c
Branches
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment