Skip to content

Commit f026bea

Browse files
authored
Merge branch 'main' into changelog
2 parents c63f50c + 5849c23 commit f026bea

20 files changed

+108
-92
lines changed

judge/create_cgroups.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ You can try using cgroup V1 by adding systemd.unified_cgroup_hierarchy=0 to the
3434
if ! echo "+cpuset" >> /sys/fs/cgroup/cgroup.subtree_control; then
3535
cgroup_error_and_usage "Error: Cannot add +cpuset to cgroup.subtree_control; check kernel params."
3636
fi
37-
if ! grep -q "slice" /proc/self/cgroup; then
38-
cgroup_error_and_usage "Error: Cgroups not configured properly, missing systemd slice under /proc/self/cgroup. If running under docker, make sure to set cgroupns=host."
37+
if grep -q ":/$" /proc/self/cgroup; then
38+
cgroup_error_and_usage "Error: Cgroups not configured properly, missing cgroup hierarchy prefix under /proc/self/cgroup. If running in a container, make sure to set cgroupns=host."
3939
fi
4040

4141
else # Trying cgroup V1:

judge/judgedaemon.main.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,16 @@ function judge(array $judgeTask): bool
14511451
$passdir = $testcasedir . '/' . $passCnt;
14521452
mkdir($passdir, 0755, true);
14531453

1454+
// In multi-pass problems, all files in the feedback directory
1455+
// are guaranteed to persist between passes, except `nextpass.in`.
1456+
// So, we recursively copy the feedback directory for every pass
1457+
// after the first (note that $passCnt starts at 1).
1458+
if ($passCnt > 1) {
1459+
$prevPassdir = $testcasedir . '/' . ($passCnt - 1) . '/feedback';
1460+
system('cp -R ' . dj_escapeshellarg($prevPassdir) . ' ' . dj_escapeshellarg($passdir . '/'));
1461+
system('rm ' . dj_escapeshellarg($passdir . '/feedback/nextpass.in'));
1462+
}
1463+
14541464
// Copy program with all possible additional files to testcase
14551465
// dir. Use hardlinks to preserve space with big executables.
14561466
$programdir = $passdir . '/execdir';

judge/testcase_run.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ if [ $COMBINED_RUN_COMPARE -eq 1 ]; then
197197
# A combined run and compare script may now already need the
198198
# feedback directory, and perhaps access to the test answers (but
199199
# only the original that lives outside the chroot).
200-
mkdir feedback
200+
mkdir -p feedback
201201
RUNARGS="$RUNARGS $TESTOUT compare.meta feedback"
202202
fi
203203

@@ -234,8 +234,8 @@ if [ $COMBINED_RUN_COMPARE -eq 0 ]; then
234234

235235
exitcode=0
236236
# Create dir for feedback files and make it writable for $RUNUSER
237-
mkdir feedback
238-
chmod a+w feedback
237+
mkdir -p feedback
238+
chmod -R a+w feedback
239239

240240
runcheck $GAINROOT "$RUNGUARD" ${DEBUG:+-v} $CPUSET_OPT -u "$RUNUSER" -g "$RUNGROUP" \
241241
-m $SCRIPTMEMLIMIT -t $SCRIPTTIMELIMIT --no-core \

webapp/src/Controller/Jury/SubmissionController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,10 +889,12 @@ public function sourceAction(
889889
->andWhere('s.problem = :probid')
890890
->andWhere('s.language = :langid')
891891
->andWhere('s.submittime < :submittime')
892+
->andWhere('s.contest = :contest')
892893
->setParameter('teamid', $submission->getTeam())
893894
->setParameter('probid', $submission->getProblem())
894895
->setParameter('langid', $submission->getLanguage())
895896
->setParameter('submittime', $submission->getSubmittime())
897+
->setParameter('contest', $submission->getContest())
896898
->orderBy('s.submittime', 'DESC')
897899
->setMaxResults(1)
898900
->getQuery()

webapp/src/Controller/PublicController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,15 @@ public function submissionsDataAction(Request $request, ?string $teamId, ?string
330330
}
331331

332332
$scoreboard = $this->scoreboardService->getScoreboard($contest);
333+
$teamIds = array_map(fn(Team $team) => $team->getTeamid(), $scoreboard->getTeamsInDescendingOrder());
333334

334335
/** @var Submission[] $submissions */
335336
$submissions = $this->submissionService->getSubmissionList(
336337
[$contest->getCid() => $contest],
337-
restrictions: new SubmissionRestriction(valid: true),
338+
restrictions: new SubmissionRestriction(
339+
teamIds: $teamIds,
340+
valid: true,
341+
),
338342
paginated: false
339343
)[0];
340344

webapp/templates/base.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
{% block extrahead %}
2222
<link rel="stylesheet" href="{{ asset('style_domjudge.css') }}">
2323

24-
{{ extrahead|default('') }}
24+
{{ extrahead | default('') }}
2525
{% endblock %}
2626
{% for file in customAssetFiles('css') %}
2727
<link rel="stylesheet" href="{{ asset('css/custom/' ~ file) }}">
2828
{% endfor %}
2929
</head>
30-
<body{% if static is defined and static %} class="static"{% endif%}>
30+
<body{% if static is defined and static %} class="static"{% endif %}>
3131
{% block menu %}{% endblock %}
3232
{% block body %}
3333
<div class="container-fluid">
@@ -36,7 +36,7 @@
3636
{% block messages %}
3737
{% include 'partials/messages.html.twig' %}
3838
{% endblock %}
39-
{% block content %}{{ body|raw }}{% endblock %}
39+
{% block content %}{{ body | raw }}{% endblock %}
4040
</div>
4141
</div>
4242
</div>

webapp/templates/form_theme.html.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{% use 'bootstrap_5_layout.html.twig' %}
22

33
{% block choice_widget_collapsed -%}
4-
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control form-select')|trim}) -%}
4+
{%- set attr = attr | merge({class: (attr.class | default('') ~ ' form-control form-select') | trim}) -%}
55
{{- parent() -}}
66
{%- endblock choice_widget_collapsed %}
77

88
{% block button_widget -%}
9-
{% set attr = attr|merge({class: (attr.class|default('') ~ ' btn')|trim}) %}
9+
{% set attr = attr | merge({class: (attr.class | default('') ~ ' btn') | trim}) %}
1010
{% if label is empty -%}
1111
{%- if label_format is not empty -%}
12-
{% set label = label_format|replace({
12+
{% set label = label_format | replace({
1313
'%name%': name,
1414
'%id%': id,
1515
}) %}
1616
{%- else -%}
17-
{% set label = name|humanize %}
17+
{% set label = name | humanize %}
1818
{%- endif -%}
1919
{%- endif -%}
20-
{% if icon|default %}
20+
{% if icon | default %}
2121
{% set iconHtml = '<i class="fa ' ~ icon ~ '"></i> ' %}
2222
{% else %}
2323
{% set iconHtml = '' %}
2424
{% endif %}
25-
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ iconHtml|raw }}{{ label|trans({}, translation_domain) }}</button>
25+
<button type="{{ type | default('button') }}" {{ block('button_attributes') }}>{{ iconHtml | raw }}{{ label | trans({}, translation_domain) }}</button>
2626
{%- endblock button_widget %}
2727

2828
{% block form_widget_simple %}

webapp/templates/jury/analysis/contest_overview.html.twig

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
{% block extrahead %}
66
{{ parent() }}
7-
<link rel="stylesheet" href="{{asset('css/nv.d3.min.css')}}">
8-
<script src="{{asset('js/d3.min.js')}}"></script>
9-
<script src="{{asset('js/nv.d3.min.js')}}"></script>
10-
<script src="{{asset('js/FileSaver.min.js')}}"></script>
7+
<link rel="stylesheet" href="{{ asset('css/nv.d3.min.css') }}">
8+
<script src="{{ asset('js/d3.min.js') }}"></script>
9+
<script src="{{ asset('js/nv.d3.min.js') }}"></script>
10+
<script src="{{ asset('js/FileSaver.min.js') }}"></script>
1111
<style>
1212
.card-body.tablecard{
1313
overflow-y: auto;
@@ -50,9 +50,9 @@ $(function() {
5050
<br>
5151
Calculated as:<br>
5252
average across all teams of [3 people x (number of minutes elapsed - minute last problem solved by team t)]
53-
">Misery index</abbr>: {{misc.misery_index|number_format(0)}} minutes<br>
53+
">Misery index</abbr>: {{ misc.misery_index | number_format(0) }} minutes<br>
5454
# Submissions: {{ misc.total_submissions }}<br>
55-
# Accepted Submissions: {{ misc.total_accepted }} <span class="text-muted">(~{{ (misc.total_submissions>0 ? (misc.total_accepted/misc.total_submissions)*100:0)|number_format(0) }}%)</span><br>
55+
# Accepted Submissions: {{ misc.total_accepted }} <span class="text-muted">(~{{ (misc.total_submissions>0 ? (misc.total_accepted/misc.total_submissions)*100:0) | number_format(0) }}%)</span><br>
5656
# of Teams: {{ misc.num_teams }}<br>
5757
</div>
5858
</div>
@@ -116,13 +116,13 @@ $(function() {
116116
{% set id=p.probid %}
117117
<tr>
118118
{% set link = path('analysis_problem', {'probid': id, 'view': view}) %}
119-
<td scope="row"><a href="{{path('analysis_problem', {'probid': id, 'view': view}) }}">{{ id }}</a></td>
119+
<td scope="row"><a href="{{ path('analysis_problem', {'probid': id, 'view': view}) }}">{{ id }}</a></td>
120120
<td><a href="{{ link }}">{{ p | problemBadge }} {{ p.problem.name }}</a></td>
121121
<td><a href="{{ link }}">{{ p.problem.timelimit }}</a></td>
122-
<td><a href="{{ link }}">{{ p.problem.memlimit|default('default') }}</a></td>
122+
<td><a href="{{ link }}">{{ p.problem.memlimit | default('default') }}</a></td>
123123
<td><a href="{{ link }}">{{ misc.problem_num_testcases[id] }}</a></td>
124-
<td><a href="{{ link }}">{{ misc.problem_attempts[id]|default(0) }} / {{ misc.problem_solutions[id]|default(0) }}</a></td>
125-
<td><a href="{{ link }}">{{ misc.problem_stats.teams_attempted[id]|default([])|length }} / {{ misc.problem_stats.teams_solved[id]|default([])|length }}</a></td>
124+
<td><a href="{{ link }}">{{ misc.problem_attempts[id] | default(0) }} / {{ misc.problem_solutions[id] | default(0) }}</a></td>
125+
<td><a href="{{ link }}">{{ misc.problem_stats.teams_attempted[id] | default([]) | length }} / {{ misc.problem_stats.teams_solved[id] | default([]) | length }}</a></td>
126126
</tr>
127127
{% endfor %}
128128
</tbody>
@@ -156,8 +156,8 @@ $(function() {
156156
<td><a href="{{ link }}">{% if t.affiliation %}{{ t.affiliation.name }}{% else %}-{% endif %}</a></td>
157157
<td class="truncate" style="max-width: 200px"><a href="{{ link }}">{{ t.effectiveName }}</a></td>
158158
<td><a href="{{ link }}">{{ misc.team_stats[id].total_submitted }} / {{ misc.team_stats[id].total_accepted }}</a></td>
159-
<td><a href="{{ link }}">{{ misc.team_stats[id].problems_submitted|length }} / {{ misc.team_stats[id].problems_accepted|length }}</a></td>
160-
<td><a href="{{ link }}">{{ misc.team_stats[id].misery_index|number_format(0) }}</a></td>
159+
<td><a href="{{ link }}">{{ misc.team_stats[id].problems_submitted | length }} / {{ misc.team_stats[id].problems_accepted | length }}</a></td>
160+
<td><a href="{{ link }}">{{ misc.team_stats[id].misery_index | number_format(0) }}</a></td>
161161
</tr>
162162
{% endfor %}
163163
</tbody>
@@ -173,7 +173,7 @@ $(function() {
173173
Delayed Judgings (by more than {{ delayed_judgings.delay }}s)
174174
</div>
175175
<div class="card-body tablecard">
176-
{% if delayed_judgings.data|length > 0 %}
176+
{% if delayed_judgings.data | length > 0 %}
177177
<table class="table table-sm table-striped table-hover table-full-clickable-cell">
178178
<thead>
179179
<tr>
@@ -235,7 +235,7 @@ var language_stats = [
235235
values: [
236236
{% for lang,count in misc.language_stats.total_submissions %}
237237
{
238-
"label" : "{{lang}}",
238+
"label" : "{{ lang }}",
239239
"value" : {{ count }},
240240
},
241241
{% endfor %}
@@ -247,7 +247,7 @@ var language_stats = [
247247
values: [
248248
{% for lang,count in misc.language_stats.total_solutions %}
249249
{
250-
"label" : "{{lang}}",
250+
"label" : "{{ lang }}",
251251
"value" : {{ count }},
252252
},
253253
{% endfor %}
@@ -288,8 +288,8 @@ var problem_stats = [
288288
values: [
289289
{% for prob in problems %}
290290
{
291-
"label" : "{{prob.shortname}}",
292-
"value" : {{ misc.problem_stats.teams_attempted[prob.probid]|default([])|length }},
291+
"label" : "{{ prob.shortname }}",
292+
"value" : {{ misc.problem_stats.teams_attempted[prob.probid] | default([]) | length }},
293293
},
294294
{% endfor %}
295295
]
@@ -300,8 +300,8 @@ var problem_stats = [
300300
values: [
301301
{% for prob in problems %}
302302
{
303-
"label" : "{{prob.shortname}}",
304-
"value" : {{ misc.problem_stats.teams_solved[prob.probid]|default([])|length }},
303+
"label" : "{{ prob.shortname }}",
304+
"value" : {{ misc.problem_stats.teams_solved[prob.probid] | default([]) | length }},
305305
},
306306
{% endfor %}
307307
]
@@ -344,8 +344,8 @@ nv.addGraph(function() {
344344
const submission_stats = [
345345
{% for result in ['correct', 'wrong-answer', 'timelimit', 'run-error', 'compiler-error', 'no-output'] %}
346346
{
347-
key: "{{result}}",
348-
color: "{{colors[result]}}",
347+
key: "{{ result }}",
348+
color: "{{ colors[result] }}",
349349
values: []
350350
},
351351
{% endfor %}

webapp/templates/jury/analysis/problem.html.twig

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
{% block extrahead %}
66
{{ parent() }}
7-
<link rel="stylesheet" href="{{asset('css/nv.d3.min.css')}}">
8-
<script src="{{asset('js/d3.min.js')}}"></script>
9-
<script src="{{asset('js/nv.d3.min.js')}}"></script>
10-
<script src="{{asset('js/FileSaver.min.js')}}"></script>
7+
<link rel="stylesheet" href="{{ asset('css/nv.d3.min.css') }}">
8+
<script src="{{ asset('js/d3.min.js') }}"></script>
9+
<script src="{{ asset('js/nv.d3.min.js') }}"></script>
10+
<script src="{{ asset('js/FileSaver.min.js') }}"></script>
1111
<style>
1212
.row.equal {
1313
display: flex;
@@ -31,16 +31,16 @@
3131
<div class="card-body">
3232
<dl class="row">
3333
<dt class="col-sm-6"># Submissions</dt>
34-
<dd class="col-sm-6">{{ submissions|length }}</dd>
34+
<dd class="col-sm-6">{{ submissions | length }}</dd>
3535

3636
<dt class="col-sm-6"># Correct</dt>
37-
<dd class="col-sm-6">{{ results['correct']|default(0) }} <span class="text-muted">({{ misc.correct_percentage|number_format(2) }}%)</span></dd>
37+
<dd class="col-sm-6">{{ results['correct'] | default(0) }} <span class="text-muted">({{ misc.correct_percentage | number_format(2) }}%)</span></dd>
3838

3939
<dt class="col-sm-6"># Teams Attempted</dt>
4040
<dd class="col-sm-6">{{ misc.num_teams_attempted }}</dd>
4141

4242
<dt class="col-sm-6"># Teams Correct</dt>
43-
<dd class="col-sm-6">{{misc.num_teams_correct}} <span class="text-muted">({{ misc.teams_correct_percentage|number_format(2) }}%)</dd>
43+
<dd class="col-sm-6">{{ misc.num_teams_correct }} <span class="text-muted">({{ misc.teams_correct_percentage | number_format(2) }}%)</dd>
4444
</dl>
4545
</div>
4646
</div>
@@ -163,9 +163,9 @@ $(function(){
163163
line = d3.select('#maxruntime svg #maxline')
164164
.attr({
165165
x1: chart.margin().left,
166-
y1: chart.yAxis.scale()({{timelimit}})+ chart.margin().top,
166+
y1: chart.yAxis.scale()({{ timelimit }})+ chart.margin().top,
167167
x2: +svgsize - chart.margin().right,
168-
y2: chart.yAxis.scale()({{timelimit}}) + chart.margin().top,
168+
y2: chart.yAxis.scale()({{ timelimit }}) + chart.margin().top,
169169
})
170170
}
171171
updateline();
@@ -184,7 +184,7 @@ $(function(){
184184
values: [
185185
{% for result,count in results %}
186186
{
187-
"label" : "{{result}}",
187+
"label" : "{{ result }}",
188188
"value" : {{ count }},
189189
"color" : "{{ colors[result] }}",
190190
},
@@ -218,8 +218,8 @@ $(function(){
218218
const submission_stats = [
219219
{% for result in ['correct', 'wrong-answer', 'timelimit', 'run-error', 'compiler-error', 'no-output'] %}
220220
{
221-
key: "{{result}}",
222-
color: "{{colors[result]}}",
221+
key: "{{ result }}",
222+
color: "{{ colors[result] }}",
223223
values: []
224224
},
225225
{% endfor %}

0 commit comments

Comments
 (0)