From feed29b8b6040cb7657c39ba5d05d7019ec8476a Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sat, 23 Mar 2024 10:56:24 +0100 Subject: [PATCH 01/15] Ugly code for a mobile-friendly view, only for demonstration purposes. --- webapp/public/style_domjudge.css | 21 +++ webapp/src/Twig/TwigExtension.php | 37 ++++ .../partials/scoreboard_table.html.twig | 173 +++++++++++++++++- 3 files changed, 228 insertions(+), 3 deletions(-) diff --git a/webapp/public/style_domjudge.css b/webapp/public/style_domjudge.css index e443f7271c..6962ee6662 100644 --- a/webapp/public/style_domjudge.css +++ b/webapp/public/style_domjudge.css @@ -699,3 +699,24 @@ blockquote { padding: 3px; border-radius: 5px; } + +.strike-diagonal { + position: relative; + text-align: center; +} + +.strike-diagonal:before { + position: absolute; + content: ""; + left: 0; + top: 50%; + right: 0; + border-top: 2px solid; + border-color: firebrick; + + -webkit-transform:rotate(-35deg); + -moz-transform:rotate(-35deg); + -ms-transform:rotate(-35deg); + -o-transform:rotate(-35deg); + transform:rotate(-35deg); +} \ No newline at end of file diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index 2a73e324e4..93f7ebdc38 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -23,6 +23,7 @@ use App\Service\DOMJudgeService; use App\Service\EventLogService; use App\Service\SubmissionService; +use App\Utils\Scoreboard\ScoreboardMatrixItem; use App\Utils\Utils; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\EntityManagerInterface; @@ -110,6 +111,7 @@ public function getFilters(): array new TwigFilter('fileTypeIcon', $this->fileTypeIcon(...)), new TwigFilter('problemBadge', $this->problemBadge(...), ['is_safe' => ['html']]), new TwigFilter('problemBadgeForContest', $this->problemBadgeForContest(...), ['is_safe' => ['html']]), + new TwigFilter('problemBadgeMaybe', $this->problemBadgeMaybe(...), ['is_safe' => ['html']]), new TwigFilter('printMetadata', $this->printMetadata(...), ['is_safe' => ['html']]), new TwigFilter('printWarningContent', $this->printWarningContent(...), ['is_safe' => ['html']]), new TwigFilter('entityIdBadge', $this->entityIdBadge(...), ['is_safe' => ['html']]), @@ -1091,6 +1093,41 @@ public function problemBadge(ContestProblem $problem, bool $grayedOut = false): ); } + public function problemBadgeMaybe(ContestProblem $problem, ScoreboardMatrixItem $matrixItem): string + { + $rgb = Utils::convertToHex($problem->getColor() ?? '#ffffff'); + if (!$matrixItem->isCorrect) { + $rgb = 'whitesmoke'; + } + $background = Utils::parseHexColor($rgb); + + // Pick a border that's a bit darker. + $darker = $background; + $darker[0] = max($darker[0] - 64, 0); + $darker[1] = max($darker[1] - 64, 0); + $darker[2] = max($darker[2] - 64, 0); + $border = Utils::rgbToHex($darker); + + // Pick the foreground text color based on the background color. + $foreground = ($background[0] + $background[1] + $background[2] > 450) ? '#000000' : '#ffffff'; + if (!$matrixItem->isCorrect) { + $foreground = 'silver'; + $border = 'linen'; + } + + $ret = sprintf( + '%s', + $rgb, + $border, + $foreground, + $problem->getShortname() + ); + if (!$matrixItem->isCorrect && $matrixItem->numSubmissions > 0) { + $ret = '' . $ret . ''; + } + return $ret; + } + public function problemBadgeForContest(Problem $problem, ?Contest $contest = null): string { $contest ??= $this->dj->getCurrentContest(); diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index b0f64f2eab..f4bad952ed 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -28,7 +28,7 @@ {% endif %} - +
{# output table column groups (for the styles) #} @@ -316,6 +316,173 @@
+ + + {# output table column groups (for the styles) #} + + + {% if showFlags %} + + {% else %} + + {% endif %} + {% if showAffiliationLogos %} + + {% endif %} + + + + + + + {% set teamColspan = 2 %} + {% if showAffiliationLogos %} + {% set teamColspan = teamColspan + 1 %} + {% endif %} + + + + + + + + + {% set previousSortOrder = -1 %} + {% set previousTeam = null %} + {% set backgroundColors = {"#FFFFFF": 1} %} + {% set medalCount = 0 %} + {% for score in scores %} + {% set classes = [] %} + {% if score.team.category.sortorder != previousSortOrder %} + {% if previousSortOrder != -1 %} + {# Output summary of previous sort order #} + {% include 'partials/scoreboard_summary.html.twig' with {sortOrder: previousSortOrder} %} + {% endif %} + {% set classes = classes | merge(['sortorderswitch']) %} + {% set previousSortOrder = score.team.category.sortorder %} + {% set previousTeam = null %} + {% endif %} + + {# process medal color #} + {% set medalColor = '' %} + {% if showLegends %} + {% set medalColor = score.team | medalType(contest, scoreboard) %} + {% endif %} + + {# check whether this is us, otherwise use category colour #} + {% if myTeamId is defined and myTeamId == score.team.teamid %} + {% set classes = classes | merge(['scorethisisme']) %} + {% set color = '#FFFF99' %} + {% else %} + {% set color = score.team.category.color %} + {% endif %} + + + + {% if showAffiliationLogos %} + + {% endif %} + {% if color is null %} + {% set color = "#FFFFFF" %} + {% set colorClass = "_FFFFFF" %} + {% else %} + {% set colorClass = color | replace({"#": "_"}) %} + {% set backgroundColors = backgroundColors | merge({(color): 1}) %} + {% endif %} + + {% set totalTime = score.totalTime %} + {% if scoreInSeconds %} + {% set totalTime = totalTime | printTimeRelative %} + {% endif %} + {% set totalPoints = score.numPoints %} + + + + + + {% endfor %} + +
rankteamscore
+ {# Only print rank when score is different from the previous team #} + {% if not displayRank %} + ? + {% elseif previousTeam is null or scoreboard.scores[previousTeam.teamid].rank != score.rank %} + {{ score.rank }} + {% else %} + {% endif %} + {% set previousTeam = score.team %} + + {% if showFlags %} + {% if score.team.affiliation %} + {% set link = null %} + {% if jury %} + {% set link = path('jury_team_affiliation', {'affilId': score.team.affiliation.affilid}) %} + {% endif %} + + {{ score.team.affiliation.country|countryFlag }} + + {% endif %} + {% endif %} + + {% if score.team.affiliation %} + {% set link = null %} + {% if jury %} + {% set link = path('jury_team_affiliation', {'affilId': score.team.affiliation.affilid}) %} + {% endif %} + + {% set affiliationId = score.team.affiliation.externalid %} + {% set affiliationImage = affiliationId | assetPath('affiliation') %} + {% if affiliationImage %} + {{ score.team.affiliation.name }} + {% else %} + {{ affiliationId }} + {% endif %} + + {% endif %} + + {% set link = null %} + {% set extra = null %} + {% if static %} + {% set link = '#' %} + {% set extra = 'data-bs-toggle="modal" data-bs-target="#team-modal-' ~ score.team.teamid ~ '"' %} + {% else %} + {% if jury %} + {% set link = path('jury_team', {teamId: score.team.teamid}) %} + {% elseif public %} + {% set link = path('public_team', {teamId: score.team.teamid}) %} + {% set extra = 'data-ajax-modal' %} + {% else %} + {% set link = path('team_team', {teamId: score.team.teamid}) %} + {% set extra = 'data-ajax-modal' %} + {% endif %} + {% endif %} + + + {% if false and usedCategories | length > 1 and scoreboard.bestInCategory(score.team, limitToTeamIds) %} + + {{ score.team.category.name }} + + {% endif %} + {{ score.team.effectiveName }} + + {% if showAffiliations %} + + {% if score.team.affiliation %} + {{ score.team.affiliation.name }} + {% endif %} + + {% endif %} + + {{ totalPoints }}
{{ totalTime }}
+ + {% for problem in problems %} + {% set matrixItem = scoreboard.matrix[score.team.teamid][problem.probid] %} + {{ problem | problemBadgeMaybe(matrixItem) }} + {% endfor %} +
+ {% if static %} {% for score in scores %} {% embed 'partials/modal.html.twig' with {'modalId': 'team-modal-' ~ score.team.teamid} %} @@ -366,7 +533,7 @@ {% else %} {% set cellColors = {first: 'Solved first', correct: 'Solved', incorrect: 'Tried, incorrect', pending: 'Tried, pending', neutral: 'Untried'} %} {% endif %} - +
@@ -385,7 +552,7 @@ {% endif %} {% if medalsEnabled %} -
Cell colours
+
From 4d7325282ba3dc29cbb14c8daeeda3e89e7b886d Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 5 Apr 2024 15:19:35 +0200 Subject: [PATCH 02/15] Update mobile scoreboard. - Make team names not fall of the screen by calculating their max width. - Make non mobile scoreboard not left-aligned. - Add a bit of margin to the header. - Make the problem boxes right aligned. - Change the card at the top to show 2 lines (name + contestt time) on mobile. --- webapp/public/style_domjudge.css | 3 +- .../templates/partials/scoreboard.html.twig | 52 +++++++++++-------- webapp/templates/public/scoreboard.html.twig | 3 +- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/webapp/public/style_domjudge.css b/webapp/public/style_domjudge.css index 6962ee6662..7ca835411f 100644 --- a/webapp/public/style_domjudge.css +++ b/webapp/public/style_domjudge.css @@ -219,6 +219,7 @@ del { display: block; overflow: hidden; } + .toolong:after { content: ""; width: 30%; @@ -719,4 +720,4 @@ blockquote { -ms-transform:rotate(-35deg); -o-transform:rotate(-35deg); transform:rotate(-35deg); -} \ No newline at end of file +} diff --git a/webapp/templates/partials/scoreboard.html.twig b/webapp/templates/partials/scoreboard.html.twig index 3c4f58e4e0..4fb8a18bfb 100644 --- a/webapp/templates/partials/scoreboard.html.twig +++ b/webapp/templates/partials/scoreboard.html.twig @@ -18,31 +18,37 @@ {% endif %}
-
- {{ current_contest.name }} - - {% if scoreboard is null %} - {{ current_contest | printContestStart }} - {% elseif scoreboard.freezeData.showFinal(jury) %} - {% if current_contest.finalizetime is empty %} - preliminary results - not final - {% else %} - final standings - {% endif %} - {% elseif scoreboard.freezeData.stopped %} - contest over, waiting for results - {% elseif static %} - {% set now = 'now'|date('U') %} - {{ current_contest.starttime | printelapsedminutes(now) }} - {% else %} - {% if current_contest.freezeData.started %} - started: +
+
+
+ {{ current_contest.name }} +
+
+ + {% if scoreboard is null %} + {{ current_contest | printContestStart }} + {% elseif scoreboard.freezeData.showFinal(jury) %} + {% if current_contest.finalizetime is empty %} + preliminary results - not final + {% else %} + final standings + {% endif %} + {% elseif scoreboard.freezeData.stopped %} + contest over, waiting for results + {% elseif static %} + {% set now = 'now'|date('U') %} + {{ current_contest.starttime | printelapsedminutes(now) }} {% else %} - starts: + {% if current_contest.freezeData.started %} + started: + {% else %} + starts: + {% endif %} + {{ current_contest.starttime | printtime }} - ends: {{ current_contest.endtime | printtime }} {% endif %} - {{ current_contest.starttime | printtime }} - ends: {{ current_contest.endtime | printtime }} - {% endif %} - + +
+
{% if static %} diff --git a/webapp/templates/public/scoreboard.html.twig b/webapp/templates/public/scoreboard.html.twig index 6ab323c152..90b7cddd7a 100644 --- a/webapp/templates/public/scoreboard.html.twig +++ b/webapp/templates/public/scoreboard.html.twig @@ -12,7 +12,7 @@ {% set bannerImage = globalBannerAssetPath() %} {% endif %} {% if bannerImage %} - + {% endif %}
@@ -53,6 +53,7 @@ {% if static and refresh is defined %} disableRefreshOnModal(); {% endif %} + resizeMobileTeamNames(); }; {% if static and refresh is defined %} From 29267914b1f90f46fa4d4d4fd854361a2afbe00a Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 5 Apr 2024 16:11:43 +0200 Subject: [PATCH 03/15] Scale problem badges for very small screens. --- webapp/public/style_domjudge.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webapp/public/style_domjudge.css b/webapp/public/style_domjudge.css index 7ca835411f..df57f21594 100644 --- a/webapp/public/style_domjudge.css +++ b/webapp/public/style_domjudge.css @@ -220,6 +220,12 @@ del { overflow: hidden; } +.mobile-problem-badges { + position: relative; + display: block; + white-space: nowrap; +} + .toolong:after { content: ""; width: 30%; From 1215fe57d9d09c48dae2f4b55233c0df7fc513a0 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Sat, 6 Apr 2024 13:28:22 +0200 Subject: [PATCH 04/15] Move scoreboard javascript to JS file so browser can cache it. --- webapp/public/js/domjudge.js | 49 ++++++++++++++++++++ webapp/templates/public/scoreboard.html.twig | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index 97dd01eb73..4a2ef98e2d 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -944,3 +944,52 @@ function initializeKeyboardShortcuts() { } }); } + +// Make sure the items in the desktop scoreboard fit +document.querySelectorAll(".desktop-scoreboard .forceWidth:not(.toolong)").forEach(el => { + if (el instanceof Element && el.scrollWidth > el.offsetWidth) { + el.classList.add("toolong"); + } +}); + +/** + * Helper method to resize mobile team names and problem badges + */ +function resizeMobileTeamNamesAndProblemBadges() { + // Make team names fit on the screen, but only when the mobile + // scoreboard is visible + const mobileScoreboard = document.querySelector('.mobile-scoreboard'); + if (mobileScoreboard.offsetWidth === 0) { + return; + } + const windowWidth = document.body.offsetWidth; + const teamNameMaxWidth = Math.max(10, windowWidth - 150); + const problemBadgesMaxWidth = Math.max(10, windowWidth - 78); + document.querySelectorAll(".mobile-scoreboard .forceWidth:not(.toolong)").forEach(el => { + el.classList.remove("toolong"); + el.style.maxWidth = teamNameMaxWidth + 'px'; + if (el instanceof Element && el.scrollWidth > el.offsetWidth) { + el.classList.add("toolong"); + } else { + el.classList.remove("toolong"); + } + }); + document.querySelectorAll(".mobile-scoreboard .mobile-problem-badges:not(.toolong)").forEach(el => { + el.classList.remove("toolong"); + el.style.maxWidth = problemBadgesMaxWidth + 'px'; + if (el instanceof Element && el.scrollWidth > el.offsetWidth) { + el.classList.add("toolong"); + const scale = el.offsetWidth / el.scrollWidth; + const offset = -1 * (el.scrollWidth - el.offsetWidth) / 2; + el.style.transform = `scale(${scale}) translateX(${offset}px)`; + } else { + el.classList.remove("toolong"); + el.style.transform = null; + } + }); +} + +if (document.querySelector('.mobile-scoreboard')) { + window.addEventListener('resize', resizeMobileTeamNamesAndProblemBadges); + resizeMobileTeamNamesAndProblemBadges(); +} diff --git a/webapp/templates/public/scoreboard.html.twig b/webapp/templates/public/scoreboard.html.twig index 90b7cddd7a..e1f0dbb559 100644 --- a/webapp/templates/public/scoreboard.html.twig +++ b/webapp/templates/public/scoreboard.html.twig @@ -53,7 +53,7 @@ {% if static and refresh is defined %} disableRefreshOnModal(); {% endif %} - resizeMobileTeamNames(); + resizeMobileTeamNamesAndProblemBadges(); }; {% if static and refresh is defined %} From 4ac6a44b2f42f8f8832ec328a0798777bb0a1920 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Mon, 8 Apr 2024 20:47:36 +0200 Subject: [PATCH 05/15] Run mobile scoreboard logic only after the page has loaded. --- webapp/public/js/domjudge.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index 4a2ef98e2d..b41497676b 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -989,7 +989,9 @@ function resizeMobileTeamNamesAndProblemBadges() { }); } -if (document.querySelector('.mobile-scoreboard')) { - window.addEventListener('resize', resizeMobileTeamNamesAndProblemBadges); - resizeMobileTeamNamesAndProblemBadges(); -} +$(function() { + if (document.querySelector('.mobile-scoreboard')) { + window.addEventListener('resize', resizeMobileTeamNamesAndProblemBadges); + resizeMobileTeamNamesAndProblemBadges(); + } +}); From 8a629c1af140cff57b116298ec81f92cece76237 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sat, 25 May 2024 13:24:01 +0200 Subject: [PATCH 06/15] Fix pending subs on mobile scoreboard. --- webapp/src/Twig/TwigExtension.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index 93f7ebdc38..ae06221a6c 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -1122,8 +1122,12 @@ public function problemBadgeMaybe(ContestProblem $problem, ScoreboardMatrixItem $foreground, $problem->getShortname() ); - if (!$matrixItem->isCorrect && $matrixItem->numSubmissions > 0) { - $ret = '' . $ret . ''; + if (!$matrixItem->isCorrect) { + if ($matrixItem->numSubmissionsPending > 0) { + $ret = '' . $ret . ''; + } else if ($matrixItem->numSubmissions > 0) { + $ret = '' . $ret . ''; + } } return $ret; } From 5f0a96368aa34180780a705e59b191d267d59db7 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 6 Sep 2024 11:49:30 +0200 Subject: [PATCH 07/15] Display as table to center align properly --- webapp/templates/partials/scoreboard_table.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index f4bad952ed..761fd2c6ca 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -28,7 +28,7 @@ {% endif %} -
Medals {% if not scoreboard.freezeData.showFinal %}(tentative){% endif %}
+
{# output table column groups (for the styles) #} @@ -533,7 +533,7 @@ {% else %} {% set cellColors = {first: 'Solved first', correct: 'Solved', incorrect: 'Tried, incorrect', pending: 'Tried, pending', neutral: 'Untried'} %} {% endif %} -
+
@@ -552,7 +552,7 @@ {% endif %} {% if medalsEnabled %} -
Cell colours
+
From 860ebcdab395095ac2f8e82ad7395a2361f2b872 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Wed, 23 Oct 2024 20:03:57 +0200 Subject: [PATCH 08/15] Hide scoreboard summary between sortorders for mobile scoreboard --- webapp/templates/partials/scoreboard_table.html.twig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index 761fd2c6ca..9fbba7c52b 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -354,10 +354,6 @@ {% for score in scores %} {% set classes = [] %} {% if score.team.category.sortorder != previousSortOrder %} - {% if previousSortOrder != -1 %} - {# Output summary of previous sort order #} - {% include 'partials/scoreboard_summary.html.twig' with {sortOrder: previousSortOrder} %} - {% endif %} {% set classes = classes | merge(['sortorderswitch']) %} {% set previousSortOrder = score.team.category.sortorder %} {% set previousTeam = null %} @@ -471,7 +467,7 @@ - {# output table column groups (for the styles) #} - + {% if enable_ranking %} + + {% endif %} {% if showFlags %} {% else %} @@ -331,9 +333,11 @@ {% endif %} - - - + {% if enable_ranking %} + + + + {% endif %} {% set teamColspan = 2 %} {% if showAffiliationLogos %} @@ -341,9 +345,13 @@ {% endif %} - + {% if enable_ranking %} + + {% endif %} - + {% if enable_ranking %} + + {% endif %} @@ -373,16 +381,18 @@ {% set color = score.team.category.color %} {% endif %} - + {% if enable_ranking %} + + {% endif %} - {% set totalTime = score.totalTime %} - {% if scoreInSeconds %} - {% set totalTime = totalTime | printTimeRelative %} + {% if enable_ranking %} + {% set totalTime = score.totalTime %} + {% if scoreInSeconds %} + {% set totalTime = totalTime | printTimeRelative %} + {% endif %} + {% set totalPoints = score.numPoints %} + {% endif %} - {% set totalPoints = score.numPoints %} - -
Medals {% if not scoreboard.freezeData.showFinal %}(tentative){% endif %}{{ totalPoints }}
{{ totalTime }}
+ {% for problem in problems %} {% set matrixItem = scoreboard.matrix[score.team.teamid][problem.probid] %} From 9a41b9b8b1f4c29b71b9575ddda568f34bd12c96 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Wed, 23 Oct 2024 20:04:08 +0200 Subject: [PATCH 09/15] Hide ugly bar before problem badges on mobile scoreboard --- webapp/public/style_domjudge.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapp/public/style_domjudge.css b/webapp/public/style_domjudge.css index df57f21594..cccfe2d517 100644 --- a/webapp/public/style_domjudge.css +++ b/webapp/public/style_domjudge.css @@ -195,6 +195,9 @@ del { border-right: 1px solid silver; padding: 0; } +.scoreboard td.no-border, .scoreboard th.no-border { + border: none; +} .scoreboard td.score_cell { min-width: 4.2em; border-right: none; From bad0883da9c3566ff70c9e87e3d455d9af3c321f Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 22 Nov 2024 12:13:51 +0100 Subject: [PATCH 10/15] Disable ranking on mobile scoreboard when requested --- .../partials/scoreboard_table.html.twig | 54 +++++++++++-------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index 9fbba7c52b..ca6203fb82 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -320,7 +320,9 @@
rankrankteamscorescore
- {# Only print rank when score is different from the previous team #} - {% if not displayRank %} - ? - {% elseif previousTeam is null or scoreboard.scores[previousTeam.teamid].rank != score.rank %} - {{ score.rank }} - {% else %} - {% endif %} - {% set previousTeam = score.team %} - + {# Only print rank when score is different from the previous team #} + {% if not displayRank %} + ? + {% elseif previousTeam is null or scoreboard.scores[previousTeam.teamid].rank != score.rank %} + {{ score.rank }} + {% else %} + {% endif %} + {% set previousTeam = score.team %} + {% if showFlags %} {% if score.team.affiliation %} @@ -459,12 +469,14 @@ {% endif %} {{ totalPoints }}
{{ totalTime }}
{{ totalPoints }}
{{ totalTime }}
From 0274beba01d7aa065f8afb858968dc407b3f3651 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 22 Nov 2024 12:26:23 +0100 Subject: [PATCH 11/15] Allow problem badges to go below country flag and affiliation logo --- webapp/templates/partials/scoreboard_table.html.twig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index ca6203fb82..c7292c1dc0 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -479,8 +479,12 @@ {% endif %}
- + {% if showAffiliationLogos %} + {% set problemSpan = 3 %} + {% else %} + {% set problemSpan = 2 %} + {% endif %} + {% for problem in problems %} {% set matrixItem = scoreboard.matrix[score.team.teamid][problem.probid] %} {{ problem | problemBadgeMaybe(matrixItem) }} From 55aef0ffd196d5c4b3238492f127662994d2c09f Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 22 Nov 2024 12:36:20 +0100 Subject: [PATCH 12/15] Move colgroups to correct position --- .../templates/partials/scoreboard_table.html.twig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index c7292c1dc0..b186cde787 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -30,6 +30,11 @@ + {% set teamColspan = 2 %} + {% if showAffiliationLogos %} + {% set teamColspan = teamColspan + 1 %} + {% endif %} + {# output table column groups (for the styles) #} {% if enable_ranking %} @@ -58,12 +63,6 @@ {% endfor %} {% endif %} - - {% set teamColspan = 2 %} - {% if showAffiliationLogos %} - {% set teamColspan = teamColspan + 1 %} - {% endif %} - {% if enable_ranking %} @@ -317,7 +316,6 @@
- {# output table column groups (for the styles) #} {% if enable_ranking %} @@ -338,6 +336,7 @@ {% endif %} + {% set teamColspan = 2 %} {% if showAffiliationLogos %} From 5562442978e60f031c3e296a695055b1762ca1a9 Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 22 Nov 2024 13:37:33 +0100 Subject: [PATCH 13/15] Fix HTML W3C stuff --- webapp/public/style_domjudge.css | 2 +- webapp/templates/partials/scoreboard_table.html.twig | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/webapp/public/style_domjudge.css b/webapp/public/style_domjudge.css index cccfe2d517..7b8db354a2 100644 --- a/webapp/public/style_domjudge.css +++ b/webapp/public/style_domjudge.css @@ -284,7 +284,7 @@ img.affiliation-logo { .silver-medal { background-color: #aaa } .bronze-medal { background-color: #c08e55 } -#scoresolv,#scoretotal { width: 2.5em; } +#scoresolv,#scoretotal,#scoresolvmobile,#scoretotalmobile { width: 2.5em; } .scorenc,.scorett,.scorepl { text-align: center; width: 2ex; } .scorenc { font-weight: bold; } td.scorenc { border-color: silver; border-right: 0; } diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index b186cde787..5077ca53f3 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -38,22 +38,22 @@ {# output table column groups (for the styles) #} {% if enable_ranking %} - + {% endif %} {% if showFlags %} - + {% else %} {% endif %} {% if showAffiliationLogos %} - + {% endif %} - + {% if enable_ranking %} - - + + {% endif %} From 1de27f078b9b3307b76225d84f055b422942b5cc Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 22 Nov 2024 13:45:38 +0100 Subject: [PATCH 14/15] Fix double team:xxx ID's --- webapp/public/js/domjudge.js | 4 +--- webapp/templates/partials/scoreboard_table.html.twig | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/webapp/public/js/domjudge.js b/webapp/public/js/domjudge.js index b41497676b..c0fe0496aa 100644 --- a/webapp/public/js/domjudge.js +++ b/webapp/public/js/domjudge.js @@ -246,9 +246,7 @@ function getHeartCol(row) { function getTeamname(row) { - var res = row.getAttribute("id"); - if ( res === null ) return res; - return res.replace(/^team:/, ''); + return row.getAttribute("data-team-id"); } function toggle(id, show) diff --git a/webapp/templates/partials/scoreboard_table.html.twig b/webapp/templates/partials/scoreboard_table.html.twig index 5077ca53f3..3d0d9f9607 100644 --- a/webapp/templates/partials/scoreboard_table.html.twig +++ b/webapp/templates/partials/scoreboard_table.html.twig @@ -133,7 +133,7 @@ {% else %} {% set color = score.team.category.color %} {% endif %} - + {% if enable_ranking %} + {% if enable_ranking %}
{# Only print rank when score is different from the previous team #} @@ -379,7 +379,7 @@ {% else %} {% set color = score.team.category.color %} {% endif %} -
{# Only print rank when score is different from the previous team #} From 46b490ce778b405520b1ba6db759a3496853a43d Mon Sep 17 00:00:00 2001 From: Nicky Gerritsen Date: Fri, 22 Nov 2024 14:14:34 +0100 Subject: [PATCH 15/15] Fix elseif --- webapp/src/Twig/TwigExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/Twig/TwigExtension.php b/webapp/src/Twig/TwigExtension.php index ae06221a6c..a496f540be 100644 --- a/webapp/src/Twig/TwigExtension.php +++ b/webapp/src/Twig/TwigExtension.php @@ -1125,7 +1125,7 @@ public function problemBadgeMaybe(ContestProblem $problem, ScoreboardMatrixItem if (!$matrixItem->isCorrect) { if ($matrixItem->numSubmissionsPending > 0) { $ret = '' . $ret . ''; - } else if ($matrixItem->numSubmissions > 0) { + } elseif ($matrixItem->numSubmissions > 0) { $ret = '' . $ret . ''; } }