:py:mod:`oioioi.mp.controllers` =============================== .. py:module:: oioioi.mp.controllers Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.mp.controllers.MPRegistrationController oioioi.mp.controllers.MPContestController oioioi.mp.controllers.MPRankingController Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.mp.controllers.CONTEST_RANKING_KEY .. py:data:: CONTEST_RANKING_KEY :annotation: = c .. py:class:: MPRegistrationController(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:attribute:: registration_template :annotation: = mp/registration.html .. 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:: 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:: MPContestController(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: = False .. py:attribute:: show_email_in_participants_data :annotation: = True .. py:method:: registration_controller() .. py:method:: ranking_controller() .. py:method:: update_user_result_for_problem(result) Submissions sent during the round are scored as normal. Submissions sent while the round was over but SubmissionScoreMultiplier was active are scored with given multiplier. .. py:method:: can_submit(request, problem_instance, check_round_times=True) Contest admin can always submit. Participant can submit if: a. round is active OR b. SubmissionScoreMultiplier exists and it's end_time is ahead .. py:class:: MPRankingController(contest) Bases: :py:obj:`oioioi.rankings.controllers.DefaultRankingController` Changes to Default Ranking: 1. Sum column is just after User column 2. Rounds with earlier start_date are more to the left .. py:attribute:: description .. py:method:: _iter_rounds(can_see_all, timestamp, partial_key, request=None) .. py:method:: _filter_pis_for_ranking(partial_key, queryset) .. py:method:: _render_ranking_page(key, data, page) .. py:method:: _allow_zero_score()