Skip to content

Commit

Permalink
Merge branch 'main' into judgedaemon_returncode
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj authored Nov 2, 2024
2 parents 9e00e09 + fb67ba7 commit cec1019
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/jobs/configure-checks/all.bats
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ compile_assertions_finished () {
}

@test "Install GNU C only" {
if [ "$distro_id" = "ID=fedora" ]; then
# Fedora ships with a gcc with enough C++ support
skip
fi
repo-remove clang g++
repo-install gcc libcgroup-dev
compiler_assertions gcc ''
Expand Down
7 changes: 4 additions & 3 deletions judge/judgedaemon.main.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,9 @@ function fetch_executable_internal(
$execbuildpath = $execbuilddir . '/build';
$execrunpath = $execbuilddir . '/run';
$execrunjurypath = $execbuilddir . '/runjury';
if (!is_dir($execdir) || !file_exists($execdeploypath)) {
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir), $retval);
if (!is_dir($execdir) || !file_exists($execdeploypath) ||
($combined_run_compare && file_get_contents(LIBJUDGEDIR . '/run-interactive.sh')!==file_get_contents($execrunpath))) {
system('rm -rf ' . dj_escapeshellarg($execdir) . ' ' . dj_escapeshellarg($execbuilddir));
if ($retval !== 0) {
disable('judgehost', 'hostname', $myhost, "Deleting '$execdir' or '$execbuilddir' was unsuccessful.");
}
Expand Down Expand Up @@ -1405,7 +1406,7 @@ function judge(array $judgeTask): bool

$input = $tcfile['input'];
$output = $tcfile['output'];
$passLimit = $run_config['pass_limit'];
$passLimit = $run_config['pass_limit'] ?? 1;
for ($passCnt = 1; $passCnt <= $passLimit; $passCnt++) {
$nextPass = false;
if ($passLimit > 1) {
Expand Down
Empty file modified judge/run-interactive.sh
100644 → 100755
Empty file.
27 changes: 27 additions & 0 deletions webapp/src/Service/ImportExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,9 @@ public function importAccountsJson(array $data, ?string &$message = null, ?array
*/
protected function importTeamData(array $teamData, ?string &$message, ?array &$saved = null): int
{
/** @var TeamAffiliation[] $createdAffiliations */
$createdAffiliations = [];
/** @var TeamCategory[] $createdCategories */
$createdCategories = [];
$createdTeams = [];
$updatedTeams = [];
Expand All @@ -1140,6 +1142,14 @@ protected function importTeamData(array $teamData, ?string &$message, ?array &$s
if (!empty($teamItem['team_affiliation']['shortname'])) {
// First look up if the affiliation already exists.
$teamAffiliation = $this->em->getRepository(TeamAffiliation::class)->findOneBy(['shortname' => $teamItem['team_affiliation']['shortname']]);
if (!$teamAffiliation) {
foreach ($createdAffiliations as $createdAffiliation) {
if ($createdAffiliation->getShortname() === $teamItem['team_affiliation']['shortname']) {
$teamAffiliation = $createdAffiliation;
break;
}
}
}
if (!$teamAffiliation) {
$teamAffiliation = new TeamAffiliation();
$propertyAccessor = PropertyAccess::createPropertyAccessor();
Expand All @@ -1166,6 +1176,15 @@ protected function importTeamData(array $teamData, ?string &$message, ?array &$s
}
} elseif (!empty($teamItem['team_affiliation']['externalid'])) {
$teamAffiliation = $this->em->getRepository(TeamAffiliation::class)->findOneBy(['externalid' => $teamItem['team_affiliation']['externalid']]);
if (!$teamAffiliation) {
foreach ($createdAffiliations as $createdAffiliation) {
if ($createdAffiliation->getExternalid() === $teamItem['team_affiliation']['externalid']) {
$teamAffiliation = $createdAffiliation;
break;
}
}
}

if (!$teamAffiliation) {
$teamAffiliation = new TeamAffiliation();
$teamAffiliation
Expand Down Expand Up @@ -1196,6 +1215,14 @@ protected function importTeamData(array $teamData, ?string &$message, ?array &$s

if (!empty($teamItem['team']['categoryid'])) {
$teamCategory = $this->em->getRepository(TeamCategory::class)->findOneBy(['externalid' => $teamItem['team']['categoryid']]);
if (!$teamCategory) {
foreach ($createdCategories as $createdCategory) {
if ($createdCategory->getExternalid() === $teamItem['team']['categoryid']) {
$teamCategory = $createdCategory;
break;
}
}
}
if (!$teamCategory) {
$teamCategory = new TeamCategory();
$teamCategory
Expand Down
9 changes: 9 additions & 0 deletions webapp/templates/jury/analysis/contest_overview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,15 @@ nv.addGraph(function() {
d3.select('#graph_problems svg')
.datum(problem_stats)
.call(chart);
// Hide bars with 0 height after rendering
chart.dispatch.on('renderEnd', function() {
d3.selectAll('#graph_problems .nv-bar').each(function(d) {
if (d.value === 0) {
d3.select(this).attr('height', 0);
d3.select(this).attr('y', chart.yAxis.scale()(0));
}
});
});
nv.utils.windowResize(chart.update);
return chart;
});
Expand Down
15 changes: 15 additions & 0 deletions webapp/tests/Unit/Service/ImportExportServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ public function testImportTeamsTsv(): void
File_Version 2
11 447047 24 ¡i¡i¡ Lund University LU SWE INST-42
12 447837 25 Pleading not FAUlty Friedrich-Alexander-University Erlangen-Nuremberg FAU DEU INST-43
13 447057 24 Another team from Lund Lund University LU SWE INST-42
EOF;

$expectedTeams = [
Expand Down Expand Up @@ -710,6 +711,20 @@ public function testImportTeamsTsv(): void
'name' => 'Friedrich-Alexander-University Erlangen-Nuremberg',
'country' => 'DEU',
],
], [
'externalid' => '13',
'icpcid' => '447057',
'label' => null,
'name' => 'Another team from Lund',
'category' => [
'externalid' => '24',
],
'affiliation' => [
'externalid' => '42',
'shortname' => 'LU',
'name' => 'Lund University',
'country' => 'SWE',
],
],
];

Expand Down

0 comments on commit cec1019

Please sign in to comment.