:py:mod:`oioioi.acm.controllers` ================================ .. py:module:: oioioi.acm.controllers Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.acm.controllers.ACMContestController oioioi.acm.controllers.ACMOpenContestController oioioi.acm.controllers._FakeUserResultForProblem oioioi.acm.controllers.ACMRankingController oioioi.acm.controllers.NotificationsMixinForACMContestController Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.acm.controllers.IGNORED_STATUSES .. py:data:: IGNORED_STATUSES :annotation: = ['CE', 'SE', '?'] .. py:class:: ACMContestController(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:method:: registration_controller() .. py:method:: get_round_freeze_time(round) Returns time after which any further updates should be non-public. .. py:method:: fill_evaluation_environ(environ, submission) .. py:method:: update_report_statuses(submission, queryset) Updates statuses of reports for the newly judged submission. Usually this involves looking at reports and deciding which should be ``ACTIVE`` and which should be ``SUPERSEDED``. :param submission: an instance of :class:`oioioi.contests.models.Submission` :param queryset: a queryset returning reports for the submission .. py:method:: update_submission_score(submission) Updates status, score and comment in a submission. Usually this involves looking at active reports and aggregating information from them. .. py:method:: get_submission_relative_time(submission) .. py:method:: _fill_user_result_for_problem(result, pi_submissions) .. py:method:: update_user_result_for_problem(result) .. py:method:: results_visible(request, submission) Determines whether it is a good time to show the submission's results. This method is not used directly in any code outside of the controllers. It's a helper method used in a number of other controller methods, as described. The default implementations uses the round's :attr:`~oioioi.contests.models.Round.results_date`. If it's ``None``, results are not available. Admins are always shown the results. .. py:method:: get_visible_reports_kinds(request, submission) .. py:method:: can_see_submission_score(request, submission) .. py:method:: can_see_submission_status(request, submission) Statuses are taken from initial tests which are always public. .. py:method:: render_submission_date(submission, shortened=False) .. py:method:: ranking_controller() .. py:method:: can_see_round(request_or_context, round) Determines if the current user is allowed to see the given round. If not, everything connected with this round will be hidden. The default implementation checks if the round is not in the future. .. py:method:: get_default_safe_exec_mode() .. py:class:: ACMOpenContestController(contest) Bases: :py:obj:`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_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:class:: _FakeUserResultForProblem(user, problem_instance) Bases: :py:obj:`object` .. py:property:: user_id .. py:property:: problem_instance_id .. py:method:: __repr__() Return repr(self). .. py:class:: ACMRankingController(contest) Bases: :py:obj:`oioioi.rankings.controllers.DefaultRankingController` Ranking system uses two types of keys: "partial key"s and "full key"s. Please note that full keys are abbreviated in the code as "key"s. A pair (request, partial_key) should allow to build a full key, while a partial_key can always be extracted from the full key. partial keys identify the rounds to display and are used everywhere outside controllers and rankingsd (e.g. in views and urls). However, the actual ranking contents can depend on many other factors, like user permissions. This was the reason for introduction of full keys, which are always sufficient to choose the right data for serialization and display. .. py:attribute:: description .. py:method:: _iter_rounds(can_see_all, timestamp, partial_key, request=None) .. py:method:: can_search_for_users() Determines if in this ranking, searching for users is enabled. .. py:method:: _render_ranking_page(key, data, page) .. py:method:: _get_csv_header(key, data) .. py:method:: _get_csv_row(key, row) .. py:method:: filter_users_for_ranking(key, queryset) .. py:method:: _get_old_results(freeze_time, pis, users) .. py:method:: serialize_ranking(key) Returns some data (representing ranking). This data will be used by :meth:`render_ranking` to generate the html code. .. py:class:: NotificationsMixinForACMContestController Bases: :py:obj:`object` Modifies default contest notification settings from :class:`~oioioi.contests.controllers.NotificationsMixinForContestController`. It enables sending notifications about new public messages to all participants and modifies submission notification messages so that .. py:method:: users_to_receive_public_message_notification() .. py:method:: get_notification_message_submission_judged(submission)