Skip to content

Commit fc9e403

Browse files
authored
Merge branch 'main' into liberror_cppify
2 parents 968cfce + 623a537 commit fc9e403

File tree

10 files changed

+46
-11
lines changed

10 files changed

+46
-11
lines changed

.github/jobs/configure-checks/setup_configure_image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ case $distro_id in
1010
dnf install pkg-config make bats autoconf automake util-linux -y ;;
1111
*)
1212
apt-get update; apt-get full-upgrade -y
13+
# Install g++-12 to make sure we can use -std=c++20
14+
version=$(g++ -dumpversion 2>/dev/null | awk -F'.' '{print $1}' 2>/dev/null || echo 0); [ "${version}" -lt 12 ] && apt install -y g++-12
1315
apt-get install pkg-config make bats autoconf -y ;;
1416
esac
1517

.github/workflows/autoconf-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
debian-family:
1111
strategy:
1212
matrix:
13-
version: [jammy, focal, rolling]
13+
version: [jammy, rolling]
1414
os: [ubuntu]
1515
releaseBranch:
1616
- ${{ contains(github.ref, 'gh-readonly-queue') }}

submit/submit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def warn_user(msg: str) -> None:
6060

6161

6262
def usage(msg: str) -> NoReturn:
63-
logging.error(f'error: {msg}')
63+
logging.error(f'\n\033[1;31mERROR: {msg}\033[0m\n')
6464
print(f"Type '{sys.argv[0]} --help' to get help.")
6565
exit(1)
6666

submit/submit_online.bats

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ setup() {
1313
@test "contest via parameter overrides environment" {
1414
run ./submit -c bestaatniet
1515
assert_failure 1
16-
assert_partial "error: No (valid) contest specified"
16+
assert_partial "ERROR: No (valid) contest specified"
1717

1818
run ./submit --contest=bestaatookniet
1919
assert_failure 1
20-
assert_partial "error: No (valid) contest specified"
20+
assert_partial "ERROR: No (valid) contest specified"
2121
}
2222

2323
@test "hello problem id and name are in help output" {
@@ -78,14 +78,14 @@ setup() {
7878
cp ../example_problems/hello/submissions/accepted/test-hello.java $BATS_TMPDIR/A.java
7979
run ./submit -p nonexistent -l cpp $BATS_TMPDIR/A.java <<< "n"
8080
assert_failure 1
81-
assert_partial "error: No known problem specified or detected"
81+
assert_partial "ERROR: No known problem specified or detected"
8282
}
8383

8484
@test "non existing language name emits error" {
8585
cp ../example_problems/hello/submissions/accepted/test-hello.java $BATS_TMPDIR/hello.java
8686
run ./submit -p C -l nonexistent $BATS_TMPDIR/hello.java <<< "n"
8787
assert_failure 1
88-
assert_partial "error: No known language specified or detected"
88+
assert_partial "ERROR: No known language specified or detected"
8989
}
9090

9191
@test "detect entry point Java" {

webapp/public/js/domjudge.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ $(function () {
965965
function initializeKeyboardShortcuts() {
966966
var $body = $('body');
967967
var ignore = false;
968+
const validKeys = new Set(['c', 'd', 'j', 'p', 's', 't']);
968969
$body.on('keydown', function(e) {
969970
var keysCookie = getCookie('domjudge_keys');
970971
if (keysCookie != 1 && keysCookie != "") {
@@ -1010,7 +1011,7 @@ function initializeKeyboardShortcuts() {
10101011
parts[parts.length - 1] += '?' + params[1];
10111012
}
10121013
window.location = parts.join('/');
1013-
} else if (!ignore && (key === 's' || key === 't' || key === 'p' || key === 'j' || key === 'c')) {
1014+
} else if (!ignore && validKeys.has(key)) {
10141015
if (e.shiftKey && key === 's') {
10151016
window.location = domjudge_base_url + '/jury/scoreboard';
10161017
return;
@@ -1053,6 +1054,27 @@ function initializeKeyboardShortcuts() {
10531054
$body.on('keydown', oldFunc);
10541055
if (e.key === 'Enter') {
10551056
switch (type) {
1057+
case 'd':
1058+
if (editors) {
1059+
const editorId = Object.keys(editors)[0];
1060+
const diffEditor = editors[editorId];
1061+
const select = diffEditor.submissionSelect;
1062+
if (typedSequence.length === 0) {
1063+
// Reset to no-diff.
1064+
select.selectedIndex = 0;
1065+
select.dispatchEvent(new Event('change'));
1066+
return;
1067+
}
1068+
const url = domjudge_base_url + `/jury/submissions/${typedSequence}`;
1069+
for (let i = 0; i < select.options.length; i++) {
1070+
if (select.options[i].dataset.url === url) {
1071+
select.selectedIndex = i;
1072+
select.dispatchEvent(new Event('change'));
1073+
return;
1074+
}
1075+
}
1076+
}
1077+
return;
10561078
case 's':
10571079
type = 'submissions';
10581080
break;
@@ -1308,7 +1330,7 @@ const disableButton = (btn) => {
13081330
btn.ariaDisabled=true;
13091331
}
13101332

1311-
const editors = [];
1333+
const editors = {};
13121334
function initDiffEditor(editorId) {
13131335
const wrapper = $(`#${editorId}-wrapper`);
13141336

@@ -1360,6 +1382,7 @@ function initDiffEditor(editorId) {
13601382
const diffLink = diffTitle.querySelector('a.diff-link');
13611383

13621384
const editor = {
1385+
'submissionSelect': select[0],
13631386
'getDiffMode': () => {
13641387
for (let radio of radios) {
13651388
if (radio.checked) {
@@ -1399,7 +1422,7 @@ function initDiffEditor(editorId) {
13991422
});
14001423

14011424
const selected = select[0].options[select[0].selectedIndex];
1402-
if (selected && selected.dataset.tag) {
1425+
if (!select[0].disabled && selected && selected.dataset.tag) {
14031426
setDiffTag(selected.dataset.tag);
14041427
}
14051428

webapp/public/style_domjudge.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ blockquote {
722722
padding: 20px;
723723
border-radius: 5px;
724724
z-index: 1001;
725+
overflow: auto;
725726
}
726727

727728
#keyhelp code {

webapp/src/Controller/API/TeamController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ protected function getQueryBuilder(Request $request): QueryBuilder
308308
->leftJoin('t.category', 'tc')
309309
->leftJoin('t.contests', 'c')
310310
->leftJoin('tc.contests', 'cc')
311-
->select('t, ta');
311+
->select('t, ta')
312+
->andWhere('t.enabled = 1');
312313

313314
if ($request->query->has('category')) {
314315
$queryBuilder

webapp/src/Controller/Jury/TeamController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ public function viewAction(
241241
throw new NotFoundHttpException(sprintf('Team with ID %s not found', $teamId));
242242
}
243243

244+
if (!$team->getEnabled()) {
245+
$this->addFlash('danger', 'Team is disabled and currently excluded from the scoreboard');
246+
}
247+
244248
$data = [
245249
'refresh' => [
246250
'after' => 15,

webapp/templates/jury/base.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
<code>k</code> go to the previous item, e.g. previous submission <br/>
7171
<br/>
7272

73+
<code>d</code> <code>↵</code> switch diff viewer to no diff <br/>
74+
<code>d</code> <code>[0-9]+</code> <code>↵</code> switch to diff against a submission, e.g. <code>d42↵</code> shows diff against submission 42 <br/>
75+
<br/>
76+
7377
<code>s</code> <code>↵</code> open the list of submissions <br/>
7478
<code>s</code> <code>[0-9]+</code> <code>↵</code> open a specific submission, e.g. <code>s42↵</code> to go to submission 42 <br/>
7579
<br/>

webapp/templates/jury/partials/submission_diff.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{% endif %}
2727
<div class="btn-group">
2828
<a href="#" role="button" class="btn btn-secondary btn-sm pe-none" aria-disabled="true"><i class="fas fa-code-branch"></i></a>
29-
<select class="diff-select btn btn-secondary btn-sm form-select-sm text-start" aria-label="Submission to diff against">
29+
<select class="diff-select btn btn-secondary btn-sm form-select-sm text-start" aria-label="Submission to diff against" {%- if otherSubmissions is empty %}disabled="true" aria-disabled="true"{%- endif %}>
3030
<option value="" data-tag="no-diff">No diff</option>
3131
{%- for other in otherSubmissions %}
3232
<option value="{{ other.submitid }}" data-url="{{ path('jury_submission', {submitId: other.submitid}) }}" {%- if other.tag %} data-tag="{{ other.tag }}" {%- endif %}>

0 commit comments

Comments
 (0)