:py:mod:`oioioi.contests.utils` =============================== .. py:module:: oioioi.contests.utils Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.contests.utils.RoundTimes Functions ~~~~~~~~~ .. autoapisummary:: oioioi.contests.utils.generic_rounds_times oioioi.contests.utils.rounds_times oioioi.contests.utils.contest_exists oioioi.contests.utils.has_any_rounds oioioi.contests.utils.has_any_active_round oioioi.contests.utils._public_results_visible oioioi.contests.utils.all_public_results_visible oioioi.contests.utils.all_non_trial_public_results_visible oioioi.contests.utils.has_any_submittable_problem oioioi.contests.utils.has_any_visible_problem_instance oioioi.contests.utils.submittable_problem_instances oioioi.contests.utils.visible_problem_instances oioioi.contests.utils.visible_rounds oioioi.contests.utils.aggregate_statuses oioioi.contests.utils.used_controllers oioioi.contests.utils.visible_contests oioioi.contests.utils.administered_contests oioioi.contests.utils.is_contest_admin oioioi.contests.utils.can_admin_contest oioioi.contests.utils.is_contest_basicadmin oioioi.contests.utils.is_contest_observer oioioi.contests.utils.can_see_personal_data oioioi.contests.utils.can_enter_contest oioioi.contests.utils.get_submission_or_error oioioi.contests.utils.last_break_between_rounds oioioi.contests.utils.best_round_to_display oioioi.contests.utils.has_any_contest .. py:class:: RoundTimes(start, end, contest, show_results=None, show_public_results=None, extra_time=0) Bases: :py:obj:`object` .. py:method:: is_past(current_datetime) Returns True if the round is over for a user .. py:method:: is_active(current_datetime) Returns True if the round is still active for a user .. py:method:: is_future(current_datetime) Returns True if the round is not started for a user .. py:method:: results_visible(current_datetime) Returns True if results are visible for a user. Usually show_results date decides. When a RoundTimeExtension is set for a given user and the round is still active, results publication is delayed. .. py:method:: public_results_visible(current_datetime) Returns True if the results of the round have already been made public It the contest's controller makes no distinction between personal and public results, this function returns the same as :meth:'results_visible'. Otherwise the show_public_results date is used. .. py:method:: get_start() .. py:method:: get_end() Returns end of user roundtime having regard to the extension of the rounds .. py:method:: get_key_for_comparison() .. py:function:: generic_rounds_times(request=None, contest=None) .. py:function:: rounds_times(request, contest) .. py:function:: contest_exists(request) .. py:function:: has_any_rounds(request_or_context) .. py:function:: has_any_active_round(request) .. py:function:: _public_results_visible(request, **kwargs) .. py:function:: all_public_results_visible(request) Checks if results of all rounds of the current contest are visible to public. .. py:function:: all_non_trial_public_results_visible(request) Checks if results of all non-trial rounds of the current contest are visible to public. .. py:function:: has_any_submittable_problem(request) .. py:function:: has_any_visible_problem_instance(request) .. py:function:: submittable_problem_instances(request) .. py:function:: visible_problem_instances(request) .. py:function:: visible_rounds(request) .. py:function:: aggregate_statuses(statuses) Returns first unsuccessful status or 'OK' if all are successful .. py:function:: used_controllers() Returns list of dotted paths to contest controller classes in use by contests on this instance. .. py:function:: visible_contests(request) Returns materialized set of contests visible to the logged in user. .. py:function:: administered_contests(request) Returns a list of contests for which the logged user has contest_admin permission for. .. py:function:: is_contest_admin(request) Checks if the user is the contest admin of the current contest. This permission level allows full access to all contest functionality. .. py:function:: can_admin_contest(user, contest) Checks if the user should be allowed on the admin pages of the contest. This is the same level of permissions as is_contest_basicadmin. .. py:function:: is_contest_basicadmin(request) Checks if the user is a basic admin of the current contest. This permission level allows edit access to basic contest functionality. It is also implied by having full admin privileges (is_contest_admin). .. py:function:: is_contest_observer(request) Checks if the current user can observe the current contest. .. py:function:: can_see_personal_data(request) Checks if the current user has permission to see personal data. .. py:function:: can_enter_contest(request) .. py:function:: get_submission_or_error(request, submission_id, submission_class=Submission) Returns the submission if it exists and user has rights to see it. .. py:function:: last_break_between_rounds(request_or_context) Returns the end_date of the latest past round and the start_date of the closest future round. Assumes that none of the rounds is active. .. py:function:: best_round_to_display(request, allow_past_rounds=False) .. py:function:: has_any_contest(request)