mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix allDomain
This commit is contained in:
1 parent
6385a7355b
commit
33b9b0b048
7 files changed
+21
-10
No files matched your search
@@ -34,18 +34,21 @@ export async function postJudge(rdoc: RecordDoc) {
|
||||
const pdoc = (accept && updated)
|
||||
? await problem.inc(rdoc.pdomain, rdoc.pid, 'nAccept', 1)
|
||||
: await problem.get(rdoc.pdomain, rdoc.pid);
|
||||
const difficulty = difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept);
|
||||
await Promise.all([
|
||||
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.s${rdoc.score}`, 1),
|
||||
]);
|
||||
if (pdoc) {
|
||||
const difficulty = difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept);
|
||||
await Promise.all([
|
||||
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.s${rdoc.score}`, 1),
|
||||
]);
|
||||
}
|
||||
await bus.serial('record/judge', rdoc, updated);
|
||||
}
|
||||
|
||||
export async function next(body: JudgeResultBody) {
|
||||
body.rid = new ObjectID(body.rid);
|
||||
let rdoc = await record.get(body.rid);
|
||||
if (!rdoc) return;
|
||||
const $set: Partial<RecordDoc> = {};
|
||||
const $push: any = {};
|
||||
if (body.case) {
|
||||
@@ -72,7 +75,7 @@ export async function next(body: JudgeResultBody) {
|
||||
if (body.memory !== undefined) $set.memory = body.memory;
|
||||
if (body.progress !== undefined) $set.progress = body.progress;
|
||||
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) {
|
||||
|
||||
@@ -141,7 +141,7 @@ class RecordModel {
|
||||
}
|
||||
|
||||
static getMulti(domainId: string, query: any) {
|
||||
return RecordModel.coll.find({ ...query, domainId });
|
||||
return RecordModel.coll.find({ domainId, ...query });
|
||||
}
|
||||
|
||||
static async update(
|
||||
|
||||
Reference in new issue
Block a user