Skip to content
Snippets Groups Projects
Commit 9767d8a1 authored by Martin Mareš's avatar Martin Mareš
Browse files

Merge branch 'jirka/skeny' into 'devel'

Drobnosti ve skenech

See merge request !112
parents f4d0cbd9 269dcff7
No related branches found
No related tags found
1 merge request!112Drobnosti ve skenech
......@@ -415,6 +415,7 @@ def schedule_sort_scans(job_id: int, for_user: db.User) -> int:
scans_desc = "oprav" if 'type' in job.in_json and job.in_json['type'] == "feedback" else "odevzdaných řešení"
job.type = db.JobType.sort_scans
job.created_at = mo.now
job.finished_at = None
job.expires_at = None
job.user = for_user
job.description = f'Rozdělení již roztříděných skenů {scans_desc} {contest.round.round_code_short()}'
......@@ -554,4 +555,3 @@ def handle_sort_scans(the_job: TheJob):
job.result = 'Celkem ' + mo.util_format.inflect_number(len(papers), 'roztříděné řešení', 'roztříděná řešení', 'roztříděných řešení')
else:
job.result = 'Celkem ' + mo.util_format.inflect_number(len(papers), 'roztříděná oprava', 'roztříděné opravy', 'roztříděných oprav')
the_job.expires_in_minutes = config.JOB_EXPIRATION_LONG
......@@ -28,6 +28,9 @@ function autocomplete(inp, arr, callback=null, max=10) {
if (index != -1) {
listCount++;
b = document.createElement("DIV");
if (text.toUpperCase() == val.toUpperCase()) {
b.classList.add("exact");
}
b.innerHTML = text.substr(0, index) + "<strong>" + text.substr(index, val.length) + "</strong>" + text.substr(index + val.length)
b.innerHTML += "<input type='hidden' value='" + key + "'>";
b.innerHTML += "<input type='hidden' value='" + text + "'>";
......@@ -75,6 +78,32 @@ function autocomplete(inp, arr, callback=null, max=10) {
e.stopPropagation();
});
inp.addEventListener("blur", function(e) {
var found = false;
for (i = 0; i < arr.length; i++) {
var key, text;
if (Array.isArray(arr[i])) {
key = arr[i][0]; text = arr[i][1];
} else {
key = arr[i]; text = arr[i];
}
if (inp.value.toUpperCase() == text.toUpperCase()) {
found = true;
if (callback) {
callback(key);
}
break;
}
}
if (!found) {
inp.value = "";
if (callback) {
callback(null);
}
}
});
function addActive(x) {
if (!x) return false;
removeActive(x);
......
......@@ -454,6 +454,9 @@ div.message .msg-date {
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
}
.autocomplete-items div.exact {
background-color: rgb(255, 255, 145);
}
.autocomplete-items div:hover {
background-color: #e9e9e9;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment