oioioi.contests.utils

Module Contents

Classes

Functions

generic_rounds_times([request, contest])

rounds_times(request, contest)

contest_exists(request)

has_any_rounds(request_or_context)

has_any_active_round(request)

_public_results_visible(request, **kwargs)

all_public_results_visible(request)

Checks if results of all rounds of the current contest are visible to

all_non_trial_public_results_visible(request)

Checks if results of all non-trial rounds of the current contest are

has_any_submittable_problem(request)

has_any_visible_problem_instance(request)

submittable_problem_instances(request)

visible_problem_instances(request)

visible_rounds(request)

aggregate_statuses(statuses)

Returns first unsuccessful status or 'OK' if all are successful

used_controllers()

Returns list of dotted paths to contest controller classes in use

visible_contests(request)

Returns materialized set of contests visible to the logged in user.

administered_contests(request)

Returns a list of contests for which the logged

is_contest_admin(request)

Checks if the user is the contest admin of the current contest.

can_admin_contest(user, contest)

Checks if the user should be allowed on the admin pages of the contest.

is_contest_basicadmin(request)

Checks if the user is a basic admin of the current contest.

is_contest_observer(request)

Checks if the current user can observe the current contest.

can_see_personal_data(request)

Checks if the current user has permission to see personal data.

can_enter_contest(request)

get_submission_or_error(request, submission_id[, ...])

Returns the submission if it exists and user has rights to see it.

last_break_between_rounds(request_or_context)

Returns the end_date of the latest past round and the start_date

best_round_to_display(request[, allow_past_rounds])

has_any_contest(request)

class oioioi.contests.utils.RoundTimes(start, end, contest, show_results=None, show_public_results=None, extra_time=0)[source]

Bases: object

is_past(current_datetime)[source]

Returns True if the round is over for a user

is_active(current_datetime)[source]

Returns True if the round is still active for a user

is_future(current_datetime)[source]

Returns True if the round is not started for a user

results_visible(current_datetime)[source]

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.

public_results_visible(current_datetime)[source]

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.

get_start()[source]
get_end()[source]

Returns end of user roundtime having regard to the extension of the rounds

get_key_for_comparison()[source]
oioioi.contests.utils.generic_rounds_times(request=None, contest=None)[source]
oioioi.contests.utils.rounds_times(request, contest)[source]
oioioi.contests.utils.contest_exists(request)[source]
oioioi.contests.utils.has_any_rounds(request_or_context)[source]
oioioi.contests.utils.has_any_active_round(request)[source]
oioioi.contests.utils._public_results_visible(request, **kwargs)[source]
oioioi.contests.utils.all_public_results_visible(request)[source]

Checks if results of all rounds of the current contest are visible to public.

oioioi.contests.utils.all_non_trial_public_results_visible(request)[source]

Checks if results of all non-trial rounds of the current contest are visible to public.

oioioi.contests.utils.has_any_submittable_problem(request)[source]
oioioi.contests.utils.has_any_visible_problem_instance(request)[source]
oioioi.contests.utils.submittable_problem_instances(request)[source]
oioioi.contests.utils.visible_problem_instances(request)[source]
oioioi.contests.utils.visible_rounds(request)[source]
oioioi.contests.utils.aggregate_statuses(statuses)[source]

Returns first unsuccessful status or ‘OK’ if all are successful

oioioi.contests.utils.used_controllers()[source]

Returns list of dotted paths to contest controller classes in use by contests on this instance.

oioioi.contests.utils.visible_contests(request)[source]

Returns materialized set of contests visible to the logged in user.

oioioi.contests.utils.administered_contests(request)[source]

Returns a list of contests for which the logged user has contest_admin permission for.

oioioi.contests.utils.is_contest_admin(request)[source]

Checks if the user is the contest admin of the current contest. This permission level allows full access to all contest functionality.

oioioi.contests.utils.can_admin_contest(user, contest)[source]

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.

oioioi.contests.utils.is_contest_basicadmin(request)[source]

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

oioioi.contests.utils.is_contest_observer(request)[source]

Checks if the current user can observe the current contest.

oioioi.contests.utils.can_see_personal_data(request)[source]

Checks if the current user has permission to see personal data.

oioioi.contests.utils.can_enter_contest(request)[source]
oioioi.contests.utils.get_submission_or_error(request, submission_id, submission_class=Submission)[source]

Returns the submission if it exists and user has rights to see it.

oioioi.contests.utils.last_break_between_rounds(request_or_context)[source]

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.

oioioi.contests.utils.best_round_to_display(request, allow_past_rounds=False)[source]
oioioi.contests.utils.has_any_contest(request)[source]