Skip to content

Commit cec1019

Browse files
authored
Merge branch 'main' into judgedaemon_returncode
2 parents 9e00e09 + fb67ba7 commit cec1019

File tree

6 files changed

+59
-3
lines changed

6 files changed

+59
-3
lines changed

.github/jobs/configure-checks/all.bats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ compile_assertions_finished () {
111111
}
112112

113113
@test "Install GNU C only" {
114+
if [ "$distro_id" = "ID=fedora" ]; then
115+
# Fedora ships with a gcc with enough C++ support
116+
skip
117+
fi
114118
repo-remove clang g++
115119
repo-install gcc libcgroup-dev
116120
compiler_assertions gcc ''

judge/judgedaemon.main.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,9 @@ function fetch_executable_internal(
334334
$execbuildpath = $execbuilddir . '/build';
335335
$execrunpath = $execbuilddir . '/run';
336336
$execrunjurypath = $execbuilddir . '/runjury';
337-
if (!is_dir($execdir) || !file_exists($execdeploypath)) {
338-
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir), $retval);
337+
if (!is_dir($execdir) || !file_exists($execdeploypath) ||
338+
($combined_run_compare && file_get_contents(LIBJUDGEDIR . '/run-interactive.sh')!==file_get_contents($execrunpath))) {
339+
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir));
339340
if ($retval !== 0) {
340341
disable('judgehost', 'hostname', $myhost, "Deleting '$execdir' or '$execbuilddir' was unsuccessful.");
341342
}
@@ -1405,7 +1406,7 @@ function judge(array $judgeTask): bool
14051406

14061407
$input = $tcfile['input'];
14071408
$output = $tcfile['output'];
1408-
$passLimit = $run_config['pass_limit'];
1409+
$passLimit = $run_config['pass_limit'] ?? 1;
14091410
for ($passCnt = 1; $passCnt <= $passLimit; $passCnt++) {
14101411
$nextPass = false;
14111412
if ($passLimit > 1) {

judge/run-interactive.sh

100644100755
File mode changed.

webapp/src/Service/ImportExportService.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,9 @@ public function importAccountsJson(array $data, ?string &$message = null, ?array
11271127
*/
11281128
protected function importTeamData(array $teamData, ?string &$message, ?array &$saved = null): int
11291129
{
1130+
/** @var TeamAffiliation[] $createdAffiliations */
11301131
$createdAffiliations = [];
1132+
/** @var TeamCategory[] $createdCategories */
11311133
$createdCategories = [];
11321134
$createdTeams = [];
11331135
$updatedTeams = [];
@@ -1140,6 +1142,14 @@ protected function importTeamData(array $teamData, ?string &$message, ?array &$s
11401142
if (!empty($teamItem['team_affiliation']['shortname'])) {
11411143
// First look up if the affiliation already exists.
11421144
$teamAffiliation = $this->em->getRepository(TeamAffiliation::class)->findOneBy(['shortname' => $teamItem['team_affiliation']['shortname']]);
1145+
if (!$teamAffiliation) {
1146+
foreach ($createdAffiliations as $createdAffiliation) {
1147+
if ($createdAffiliation->getShortname() === $teamItem['team_affiliation']['shortname']) {
1148+
$teamAffiliation = $createdAffiliation;
1149+
break;
1150+
}
1151+
}
1152+
}
11431153
if (!$teamAffiliation) {
11441154
$teamAffiliation = new TeamAffiliation();
11451155
$propertyAccessor = PropertyAccess::createPropertyAccessor();
@@ -1166,6 +1176,15 @@ protected function importTeamData(array $teamData, ?string &$message, ?array &$s
11661176
}
11671177
} elseif (!empty($teamItem['team_affiliation']['externalid'])) {
11681178
$teamAffiliation = $this->em->getRepository(TeamAffiliation::class)->findOneBy(['externalid' => $teamItem['team_affiliation']['externalid']]);
1179+
if (!$teamAffiliation) {
1180+
foreach ($createdAffiliations as $createdAffiliation) {
1181+
if ($createdAffiliation->getExternalid() === $teamItem['team_affiliation']['externalid']) {
1182+
$teamAffiliation = $createdAffiliation;
1183+
break;
1184+
}
1185+
}
1186+
}
1187+
11691188
if (!$teamAffiliation) {
11701189
$teamAffiliation = new TeamAffiliation();
11711190
$teamAffiliation
@@ -1196,6 +1215,14 @@ protected function importTeamData(array $teamData, ?string &$message, ?array &$s
11961215

11971216
if (!empty($teamItem['team']['categoryid'])) {
11981217
$teamCategory = $this->em->getRepository(TeamCategory::class)->findOneBy(['externalid' => $teamItem['team']['categoryid']]);
1218+
if (!$teamCategory) {
1219+
foreach ($createdCategories as $createdCategory) {
1220+
if ($createdCategory->getExternalid() === $teamItem['team']['categoryid']) {
1221+
$teamCategory = $createdCategory;
1222+
break;
1223+
}
1224+
}
1225+
}
11991226
if (!$teamCategory) {
12001227
$teamCategory = new TeamCategory();
12011228
$teamCategory

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,15 @@ nv.addGraph(function() {
345345
d3.select('#graph_problems svg')
346346
.datum(problem_stats)
347347
.call(chart);
348+
// Hide bars with 0 height after rendering
349+
chart.dispatch.on('renderEnd', function() {
350+
d3.selectAll('#graph_problems .nv-bar').each(function(d) {
351+
if (d.value === 0) {
352+
d3.select(this).attr('height', 0);
353+
d3.select(this).attr('y', chart.yAxis.scale()(0));
354+
}
355+
});
356+
});
348357
nv.utils.windowResize(chart.update);
349358
return chart;
350359
});

webapp/tests/Unit/Service/ImportExportServiceTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ public function testImportTeamsTsv(): void
679679
File_Version 2
680680
11 447047 24 ¡i¡i¡ Lund University LU SWE INST-42
681681
12 447837 25 Pleading not FAUlty Friedrich-Alexander-University Erlangen-Nuremberg FAU DEU INST-43
682+
13 447057 24 Another team from Lund Lund University LU SWE INST-42
682683
EOF;
683684

684685
$expectedTeams = [
@@ -710,6 +711,20 @@ public function testImportTeamsTsv(): void
710711
'name' => 'Friedrich-Alexander-University Erlangen-Nuremberg',
711712
'country' => 'DEU',
712713
],
714+
], [
715+
'externalid' => '13',
716+
'icpcid' => '447057',
717+
'label' => null,
718+
'name' => 'Another team from Lund',
719+
'category' => [
720+
'externalid' => '24',
721+
],
722+
'affiliation' => [
723+
'externalid' => '42',
724+
'shortname' => 'LU',
725+
'name' => 'Lund University',
726+
'country' => 'SWE',
727+
],
713728
],
714729
];
715730

0 commit comments

Comments
 (0)