core: fix allDomain

This commit is contained in:
undefined committed 2021-08-17 19:03:16 +08:00
1 parent 6385a7355b
commit 33b9b0b048
7 files changed
+15 -4

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
hydro.ac {
reverse_proxy http://localhost:8888 {
header_up x-real-ip {remote_host}
header_up x-real-host {hostport}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.32.20", "version": "2.32.21",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/loader", "main": "src/loader",
"module": "src/loader", "module": "src/loader",
+4 -1
View File
@@ -34,18 +34,21 @@ export async function postJudge(rdoc: RecordDoc) {
const pdoc = (accept && updated) const pdoc = (accept && updated)
? await problem.inc(rdoc.pdomain, rdoc.pid, 'nAccept', 1) ? await problem.inc(rdoc.pdomain, rdoc.pid, 'nAccept', 1)
: await problem.get(rdoc.pdomain, rdoc.pid); : await problem.get(rdoc.pdomain, rdoc.pid);
if (pdoc) {
const difficulty = difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept); const difficulty = difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept);
await Promise.all([ await Promise.all([
problem.edit(pdoc.domainId, pdoc.docId, { difficulty }), problem.edit(pdoc.domainId, pdoc.docId, { difficulty }),
problem.inc(pdoc.domainId, pdoc.docId, `stats.${builtin.STATUS_SHORT_TEXTS[rdoc.status]}`, 1), problem.inc(pdoc.domainId, pdoc.docId, `stats.${builtin.STATUS_SHORT_TEXTS[rdoc.status]}`, 1),
problem.inc(pdoc.domainId, pdoc.docId, `stats.s${rdoc.score}`, 1), problem.inc(pdoc.domainId, pdoc.docId, `stats.s${rdoc.score}`, 1),
]); ]);
}
await bus.serial('record/judge', rdoc, updated); await bus.serial('record/judge', rdoc, updated);
} }
export async function next(body: JudgeResultBody) { export async function next(body: JudgeResultBody) {
body.rid = new ObjectID(body.rid); body.rid = new ObjectID(body.rid);
let rdoc = await record.get(body.rid); let rdoc = await record.get(body.rid);
if (!rdoc) return;
const $set: Partial<RecordDoc> = {}; const $set: Partial<RecordDoc> = {};
const $push: any = {}; const $push: any = {};
if (body.case) { if (body.case) {
@@ -72,7 +75,7 @@ export async function next(body: JudgeResultBody) {
if (body.memory !== undefined) $set.memory = body.memory; if (body.memory !== undefined) $set.memory = body.memory;
if (body.progress !== undefined) $set.progress = body.progress; if (body.progress !== undefined) $set.progress = body.progress;
rdoc = await record.update(rdoc.domainId, body.rid, $set, $push); rdoc = await record.update(rdoc.domainId, body.rid, $set, $push);
bus.broadcast('record/change', rdoc, $set, $push); bus.broadcast('record/change', rdoc!, $set, $push);
} }
export async function end(body: JudgeResultBody) { export async function end(body: JudgeResultBody) {
+1 -1
View File
@@ -141,7 +141,7 @@ class RecordModel {
} }
static getMulti(domainId: string, query: any) { static getMulti(domainId: string, query: any) {
return RecordModel.coll.find({ ...query, domainId }); return RecordModel.coll.find({ domainId, ...query });
} }
static async update( static async update(
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.17.4", "version": "4.17.5",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -22,6 +22,7 @@ const page = new NamedPage('record_main', async () => {
$oldTr.trigger('vjContentNew'); $oldTr.trigger('vjContentNew');
} else { } else {
$('.record_main__table tbody').prepend($newTr); $('.record_main__table tbody').prepend($newTr);
$('.record_main__table tbody tr:last').remove();
$newTr.trigger('vjContentNew'); $newTr.trigger('vjContentNew');
} }
}; };
@@ -20,6 +20,7 @@
{% else %} {% else %}
* *
{% endif %} {% endif %}
{% if rdoc.input %}({{ _('Pretest') }}){% endif %}
</td> </td>
<td class="col--submit-by"> <td class="col--submit-by">
<a href="{{ url('user_detail', uid=rdoc.uid) }}"> <a href="{{ url('user_detail', uid=rdoc.uid) }}">