oioioi.programs.controllers
¶
Module Contents¶
Classes¶
Defines rules for handling specific problem. |
|
Contains the contest logic and rules. |
Functions¶
|
Attributes¶
- class oioioi.programs.controllers.ProgrammingProblemController(problem)[source]¶
Bases:
oioioi.problems.controllers.ProblemController
Defines rules for handling specific problem.
Every method should:
be called from contest controller
or be specific for problems that this controller controls
Please note that a global problem instance exists for each problem. That problem instance has no contest (
contest
isNone
), so methods can’t be overridden by a contest controller which means they behave in a default way.- fill_evaluation_environ(environ, submission, **kwargs)[source]¶
Fills a minimal environment with evaluation receipt and other values required by the evaluation machinery.
Passed
environ
should already contain entries for the actiual data to be judged (for example the source file to evaluate).Details on which keys need to be present should be specified by particular subclasses.
As the result,
environ
will be filled at least with a suitable evaluationrecipe
.
- mixins_for_admin()[source]¶
Returns an iterable of mixins to add to the default
oioioi.problems.admin.ProblemAdmin
for this particular problem.The default implementation returns an empty tuple.
- render_report(request, report)[source]¶
Renders the given report to HTML.
Default implementation supports only rendering reports of kind
FAILURE
and raisesNotImplementedError
otherwise.
- can_generate_user_out(request, submission_report)[source]¶
Determines if the current user is allowed to generate outs from
submission_report
.Default implementations allow only problem admins.
- filter_visible_reports(request, submission, queryset)[source]¶
Determines which reports the user should be able to see.
It needs to check whether the submission is visible to the user and submission is submitted without contest.
- Parameters
request – Django request
submission – instance of
Submission
queryset – a queryset, initially filtered at least to select only given submission’s reports
- Returns
updated queryset
- get_safe_exec_mode()[source]¶
Determines execution mode when USE_UNSAFE_EXEC is False.
Return ‘sio2jail’ if you want to use SIO2Jail. Otherwise return ‘cpu’.
Renders the given submission footer to HTML.
Footer is shown under the submission reports. The default implementation returns an empty string.
- class oioioi.programs.controllers.ProgrammingContestController(contest)[source]¶
Bases:
oioioi.contests.controllers.ContestController
Contains the contest logic and rules.
This is the computerized implementation of the contest’s official rules.
- fill_evaluation_environ_post_problem(environ, submission)[source]¶
Run after ProblemController.fill_evaluation_environ.
- update_report_statuses(submission, queryset)[source]¶
Updates statuses of reports for the newly judged submission.
Usually this involves looking at reports and deciding which should be
ACTIVE
and which should beSUPERSEDED
.- Parameters
submission – an instance of
oioioi.contests.models.Submission
queryset – a queryset returning reports for the submission
- can_see_submission_status(request, submission)[source]¶
Statuses are taken from initial tests which are always public.
- filter_visible_reports(request, submission, queryset)[source]¶
Determines which reports the user should be able to see.
It need not check whether the submission is visible to the user.
The default implementation uses
results_visible()
.- Parameters
request – Django request
submission – instance of
Submission
queryset – a queryset, initially filtered at least to select only given submission’s reports
- Returns
updated queryset
- filter_my_visible_submissions(request, queryset, filter_user=True)[source]¶
Returns the submissions which the user should see in the “My submissions” view.
The default implementation returns all submissions belonging to the user for the problems that are visible, except for admins, which get all their submissions.
Should return the updated queryset.
- can_generate_user_out(request, submission_report)[source]¶
Determines if the current user is allowed to generate outs from
submission_report
.Default implementations delegates to
report_actions_config
associated with the problem,can_see_problem()
,filter_my_visible_submissions()
, except for admins and observers, which get full access.
- filter_visible_sources(request, queryset)[source]¶
Determines which sources the user could see.
This usually involves cross-user privileges, like publicizing sources. Default implementations delegates to
filter_my_visible_submissions()
, except for admins and observers, which get full access.Queryset’s model should be oioioi.contest.Submission
- can_see_source(request, submission)[source]¶
Check if submission’s source should be visible. :type submission: oioioi.contest.Submission
Consider using filter_visible_sources instead, especially for batch queries.
- render_submission(request, submission)[source]¶
Renders the given submission to HTML.
This is usually a table with some basic submission info, source code download etc., displayed on the top of the submission details view, above the reports.