oioioi.oi.controllers

Module Contents

Classes

OIRegistrationController

A base class for classes which should have a list of subclasses

OIContestController

Contains the contest logic and rules.

OIOnsiteContestController

Contains the contest logic and rules.

OIFinalOnsiteContestController

Contains the contest logic and rules.

BOIOnsiteContestController

Contains the contest logic and rules.

BOIOnlineContestController

Contains the contest logic and rules.

Attributes

oioioi.oi.controllers.auditLogger[source]
class oioioi.oi.controllers.OIRegistrationController(contest)[source]

Bases: 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 subclasses class attributes. Classes which have explicitly set abstract class attribute to True are not added to subclasses.

If a class has modules_with_subclasses attribute (list or string), then specified modules for all installed applications can be loaded by calling load_subclasses().

property form_class[source]
property participant_admin[source]
classmethod anonymous_can_enter_contest()[source]

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.

Return type

bool

can_enter_contest(request)[source]

Determines if the current user is allowed to enter the contest, i.e. see any page related to the contest.

The default implementation uses filter_visible_contests() with a single-element contest queryset.

Return type

bool

visible_contests_query(request)[source]

Provides a django.db.models.Q expression which can be used on 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`.

can_register(request)[source]
can_unregister(request, participant)[source]
registration_view(request)[source]
get_contest_participant_info_list(request, user)[source]

Returns a list of tuples (priority, info). Each entry represents a fragment of HTML with information about the user’s participation in the contest. This information will be visible for contest admins. It can be any information an application wants to add.

The fragments are sorted by priority (descending) and rendered in that order.

The default implementation returns basic info about the contestant: his/her full name, e-mail, the user id, his/her submissions and round time extensions.

To add additional info from another application, override this method. For integrity, include the result of the parent implementation in your output.

mixins_for_admin()[source]

Returns an iterable of mixins to add to the default oioioi.contests.admin.ContestAdmin for the contest.

The default implementation returns an empty tuple.

can_change_terms_accepted_phrase(request)[source]
Returns

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.

class oioioi.oi.controllers.OIContestController(contest)[source]

Bases: oioioi.programs.controllers.ProgrammingContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

description[source]
create_forum = True[source]
show_email_in_participants_data = True[source]
fill_evaluation_environ(environ, submission)[source]
registration_controller()[source]
can_submit(request, problem_instance, check_round_times=True)[source]

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.

can_see_stats(request)[source]
should_confirm_submission_receipt(request, submission)[source]
update_user_result_for_problem(result)[source]
default_can_see_ranking(request)[source]
default_contestlogo_url()[source]
default_contesticons_urls()[source]
class oioioi.oi.controllers.OIOnsiteContestController(contest)[source]

Bases: OIContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

description[source]
class oioioi.oi.controllers.OIFinalOnsiteContestController(contest)[source]

Bases: OIOnsiteContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

description[source]
can_see_submission_score(request, submission)[source]
update_user_result_for_problem(result)[source]
class oioioi.oi.controllers.BOIOnsiteContestController(contest)[source]

Bases: OIOnsiteContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

description[source]
create_forum = False[source]
can_see_test_comments(request, submissionreport)[source]
reveal_score(request, submission)[source]
update_user_result_for_problem(result)[source]
get_visible_reports_kinds(request, submission)[source]
can_print_files(request)[source]
default_contestlogo_url()[source]
default_contesticons_urls()[source]
fill_evaluation_environ(environ, submission)[source]
class oioioi.oi.controllers.BOIOnlineContestController(contest)[source]

Bases: BOIOnsiteContestController

Contains the contest logic and rules.

This is the computerized implementation of the contest’s official rules.

description[source]
create_forum = False[source]
registration_controller()[source]
is_onsite()[source]

Determines whether the contest is on-site.