oioioi.pa.controllers
¶
Module Contents¶
Classes¶
A base class for classes which should have a list of subclasses |
|
Contains the contest logic and rules. |
|
Problems in a PA style contest are divided into two divisions |
|
Problems in a PA style contest are divided into two divisions |
|
Contains the contest logic and rules. |
|
Contains the contest logic and rules. |
Attributes¶
- class oioioi.pa.controllers.PARegistrationController(contest)[source]¶
Bases:
oioioi.participants.controllers.ParticipantsController
A base class for classes which should have a list of subclasses available.
The list of subclasses is available in their
subclasses
class attributes. Classes which have explicitly setabstract
class attribute toTrue
are not added tosubclasses
.If a class has
modules_with_subclasses
attribute (list or string), then specified modules for all installed applications can be loaded by callingload_subclasses()
.- classmethod anonymous_can_enter_contest()[source]¶
Determines if an anonymous user can enter the contest.
Allowed anonymous users will have limited functionality, but they can see the problems, review questions etc. Modules should give them as much functionality as reasonably possible.
- Return type
bool
- allow_login_as_public_name()[source]¶
Determines if participants may choose to stay anonymous, i.e. use their logins as public names.
- can_enter_contest(request)[source]¶
Determines if the current user is allowed to enter the contest, i.e. see any page related to the contest.
The default implementation uses
filter_visible_contests()
with a single-element contest queryset.- Return type
bool
- visible_contests_query(request)[source]¶
Provides a
django.db.models.Q
expression which can be used onoioioi.contests.models.Contest
queryset already limited to contests using this controller to filter for contests the user can enter.It must not make use of attribute contest of the controller, as it is not guaranteed to be set. It is called with None contest in :function:`oioioi.contests.utils.visible_contests`.
- mixins_for_admin()[source]¶
Returns an iterable of mixins to add to the default
oioioi.contests.admin.ContestAdmin
for the contest.The default implementation returns an empty tuple.
- class oioioi.pa.controllers.PAContestController(contest)[source]¶
Bases:
oioioi.programs.controllers.ProgrammingContestController
Contains the contest logic and rules.
This is the computerized implementation of the contest’s official rules.
- separate_public_results()[source]¶
Determines if there should be two separate dates for personal results (when participants can see their scores for a given round) and public results (when round ranking is published).
Depending on the value returned, contest admins can see and modify both
Results date
andPublic results date
or only the first one.- Return type
bool
- can_submit(request, problem_instance, check_round_times=True)[source]¶
Determines if the current user is allowed to submit a solution for the given problem.
The default implementation checks if the user is not anonymous, and if the round is active for the given user. Subclasses should also call this default implementation.
- class oioioi.pa.controllers.PARankingController(contest)[source]¶
Bases:
oioioi.rankings.controllers.DefaultRankingController
Problems in a PA style contest are divided into two divisions (
A
andB
). It is also possible to set a problem’s division toNone
.There are three types of rankings in a PA style contest.
Trial round ranking. The key (the id) of such a ranking is the id of some trial round (there may be more than one trial round in a contest). Problems displayed in the ranking are the problems attached to the round whose division is set to
None
.Division
B
ranking (key =B_RANKING_KEY
). It consists of all problems from non-trial rounds whose division is set toB
.A + B
ranking (key =A_PLUS_B_RANKING_KEY
). It consists of problems from both divisions and from all non-trial rounds.
Note that if a problem belongs to
A
orB
and is attached to a trial round, it won’t belong to any ranking. The same applies to problems in non-trial rounds with division set toNone
.
- class oioioi.pa.controllers.PADivCRankingController(contest)[source]¶
Bases:
PARankingController
Problems in a PA style contest are divided into two divisions (
A
andB
). It is also possible to set a problem’s division toNone
.There are three types of rankings in a PA style contest.
Trial round ranking. The key (the id) of such a ranking is the id of some trial round (there may be more than one trial round in a contest). Problems displayed in the ranking are the problems attached to the round whose division is set to
None
.Division
B
ranking (key =B_RANKING_KEY
). It consists of all problems from non-trial rounds whose division is set toB
.A + B
ranking (key =A_PLUS_B_RANKING_KEY
). It consists of problems from both divisions and from all non-trial rounds.
Note that if a problem belongs to
A
orB
and is attached to a trial round, it won’t belong to any ranking. The same applies to problems in non-trial rounds with division set toNone
.
- class oioioi.pa.controllers.PAFinalsContestController(contest)[source]¶
Bases:
oioioi.acm.controllers.ACMContestController
Contains the contest logic and rules.
This is the computerized implementation of the contest’s official rules.