:py:mod:`oioioi.pa.controllers` =============================== .. py:module:: oioioi.pa.controllers Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.pa.controllers.PARegistrationController oioioi.pa.controllers.PAContestController oioioi.pa.controllers.PARankingController oioioi.pa.controllers.PADivCRankingController oioioi.pa.controllers.PAFinalsContestController oioioi.pa.controllers.PADivCContestController Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.pa.controllers.auditLogger oioioi.pa.controllers.A_PLUS_B_RANKING_KEY oioioi.pa.controllers.B_RANKING_KEY .. py:data:: auditLogger .. py:class:: PARegistrationController(contest) Bases: :py:obj:`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 :attr:`subclasses` class attributes. Classes which have *explicitly* set :attr:`abstract` class attribute to ``True`` are not added to :attr:`subclasses`. If a class has ``modules_with_subclasses`` attribute (list or string), then specified modules for all installed applications can be loaded by calling :meth:`~RegisteredSubclassesBase.load_subclasses`. .. py:property:: form_class .. py:property:: participant_admin .. py:method:: anonymous_can_enter_contest() :classmethod: 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. :rtype: bool .. py:method:: allow_login_as_public_name() Determines if participants may choose to stay anonymous, i.e. use their logins as public names. .. py:method:: can_enter_contest(request) Determines if the current user is allowed to enter the contest, i.e. see any page related to the contest. The default implementation uses :meth:`filter_visible_contests` with a single-element contest queryset. :rtype: bool .. py:method:: visible_contests_query(request) Provides a :class:`django.db.models.Q` expression which can be used on :class:`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`. .. py:method:: can_register(request) .. py:method:: can_unregister(request, participant) .. py:method:: registration_view(request) .. py:method:: mixins_for_admin() Returns an iterable of mixins to add to the default :class:`oioioi.contests.admin.ContestAdmin` for the contest. The default implementation returns an empty tuple. .. py:method:: can_change_terms_accepted_phrase(request) :return: 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. .. py:class:: PAContestController(contest) Bases: :py:obj:`oioioi.programs.controllers.ProgrammingContestController` Contains the contest logic and rules. This is the computerized implementation of the contest's official rules. .. py:attribute:: description .. py:attribute:: create_forum :annotation: = True .. py:method:: fill_evaluation_environ(environ, submission) .. py:method:: update_user_result_for_problem(result) .. py:method:: registration_controller() .. py:method:: ranking_controller() .. py:method:: separate_public_results() 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. :rtype: bool .. py:method:: can_submit(request, problem_instance, check_round_times=True) 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. .. py:method:: can_see_publicsolutions(request, round) .. py:method:: solutions_must_be_public(qs) .. py:method:: get_division_choices() .. py:method:: adjust_upload_form(request, existing_problem, form) .. py:method:: fill_upload_environ(request, form, env) .. py:method:: get_default_safe_exec_mode() .. py:method:: get_allowed_languages() Determines which languages are allowed for submissions. .. py:data:: A_PLUS_B_RANKING_KEY :annotation: = ab .. py:data:: B_RANKING_KEY :annotation: = b .. py:class:: PARankingController(contest) Bases: :py:obj:`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``. .. py:attribute:: description .. py:method:: _rounds_for_ranking(request, partial_key=CONTEST_RANKING_KEY) .. py:method:: _rounds_for_key(key) .. py:method:: available_rankings(request) Returns a list of available rankings. Each ranking is a pair ``(key, description)``. .. py:method:: _filter_pis_for_ranking(partial_key, queryset) .. py:method:: _allow_zero_score() .. py:class:: PADivCRankingController(contest) Bases: :py:obj:`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``. .. py:attribute:: description .. py:method:: available_rankings(request) Returns a list of available rankings. Each ranking is a pair ``(key, description)``. .. py:method:: _filter_pis_for_ranking(partial_key, queryset) .. py:class:: PAFinalsContestController(contest) Bases: :py:obj:`oioioi.acm.controllers.ACMContestController` Contains the contest logic and rules. This is the computerized implementation of the contest's official rules. .. py:attribute:: description .. py:method:: registration_controller() .. py:method:: can_print_files(request) .. py:method:: can_see_livedata(request) .. py:method:: is_onsite() Determines whether the contest is on-site. .. py:method:: default_can_see_ranking(request) .. py:method:: get_round_freeze_time(round) Returns time after which any further updates should be non-public. .. py:method:: get_safe_exec_mode() Determines execution mode when `USE_UNSAFE_EXEC` is False. Return 'sio2jail' if you want to use SIO2Jail. Otherwise return 'cpu'. .. py:class:: PADivCContestController(contest) Bases: :py:obj:`PAContestController` Contains the contest logic and rules. This is the computerized implementation of the contest's official rules. .. py:attribute:: description .. py:method:: ranking_controller() .. py:method:: get_division_choices()