oioioi.pa.controllers

Module Contents

Classes

PARegistrationController

A base class for classes which should have a list of subclasses

PAContestController

Contains the contest logic and rules.

PARankingController

Problems in a PA style contest are divided into two divisions

PADivCRankingController

Problems in a PA style contest are divided into two divisions

PAFinalsContestController

Contains the contest logic and rules.

PADivCContestController

Contains the contest logic and rules.

Attributes

oioioi.pa.controllers.auditLogger[source]
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 set abstract class attribute to True are not added to subclasses.

If a class has modules_with_subclasses attribute (list or string), then specified modules for all installed applications can be loaded by calling load_subclasses().

property form_class[source]
property participant_admin[source]
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 on oioioi.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`.

can_register(request)[source]
can_unregister(request, participant)[source]
registration_view(request)[source]
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.

can_change_terms_accepted_phrase(request)[source]
Returns

Whether the given contest has custom registered

participants (like the ones in OI and PA). Then and only then we allow to change terms accepted phrase.

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.

description[source]
create_forum = True[source]
fill_evaluation_environ(environ, submission)[source]
update_user_result_for_problem(result)[source]
registration_controller()[source]
ranking_controller()[source]
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 and Public 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.

can_see_publicsolutions(request, round)[source]
solutions_must_be_public(qs)[source]
get_division_choices()[source]
adjust_upload_form(request, existing_problem, form)[source]
fill_upload_environ(request, form, env)[source]
get_default_safe_exec_mode()[source]
get_allowed_languages()[source]

Determines which languages are allowed for submissions.

oioioi.pa.controllers.A_PLUS_B_RANKING_KEY = ab[source]
oioioi.pa.controllers.B_RANKING_KEY = b[source]
class oioioi.pa.controllers.PARankingController(contest)[source]

Bases: oioioi.rankings.controllers.DefaultRankingController

Problems in a PA style contest are divided into two divisions (A and B). It is also possible to set a problem’s division to None.

There are three types of rankings in a PA style contest.

  1. 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.

  2. Division B ranking (key = B_RANKING_KEY). It consists of all problems from non-trial rounds whose division is set to B.

  3. 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 or B 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 to None.

description[source]
_rounds_for_ranking(request, partial_key=CONTEST_RANKING_KEY)[source]
_rounds_for_key(key)[source]
available_rankings(request)[source]

Returns a list of available rankings.

Each ranking is a pair (key, description).

_filter_pis_for_ranking(partial_key, queryset)[source]
_allow_zero_score()[source]
class oioioi.pa.controllers.PADivCRankingController(contest)[source]

Bases: PARankingController

Problems in a PA style contest are divided into two divisions (A and B). It is also possible to set a problem’s division to None.

There are three types of rankings in a PA style contest.

  1. 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.

  2. Division B ranking (key = B_RANKING_KEY). It consists of all problems from non-trial rounds whose division is set to B.

  3. 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 or B 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 to None.

description[source]
available_rankings(request)[source]

Returns a list of available rankings.

Each ranking is a pair (key, description).

_filter_pis_for_ranking(partial_key, queryset)[source]
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.

description[source]
registration_controller()[source]
can_print_files(request)[source]
can_see_livedata(request)[source]
is_onsite()[source]

Determines whether the contest is on-site.

default_can_see_ranking(request)[source]
get_round_freeze_time(round)[source]

Returns time after which any further updates should be non-public.

get_safe_exec_mode()[source]

Determines execution mode when USE_UNSAFE_EXEC is False.

Return ‘sio2jail’ if you want to use SIO2Jail. Otherwise return ‘cpu’.

class oioioi.pa.controllers.PADivCContestController(contest)[source]

Bases: PAContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

description[source]
ranking_controller()[source]
get_division_choices()[source]