mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: 修复nAccept计算异常的问题
This commit is contained in:
1 parent
4652ce86ab
commit
3f78c35359
4 files changed
+8
-17
No files matched your search
@@ -18,22 +18,14 @@ const logger = new Logger('judge');
|
||||
async function _postJudge(rdoc: Rdoc) {
|
||||
if (typeof rdoc.input === 'string') return;
|
||||
const accept = rdoc.status === builtin.STATUS.STATUS_ACCEPTED;
|
||||
const tasks = [];
|
||||
tasks.push(
|
||||
problem.inc(rdoc.domainId, rdoc.pid, 'nAccept', 1),
|
||||
problem.updateStatus(rdoc.domainId, rdoc.pid, rdoc.uid, rdoc._id, rdoc.status),
|
||||
);
|
||||
const updated = await problem.updateStatus(rdoc.domainId, rdoc.pid, rdoc.uid, rdoc._id, rdoc.status);
|
||||
if (rdoc.contest) {
|
||||
tasks.push(
|
||||
contest.updateStatus(
|
||||
rdoc.domainId, rdoc.contest.tid, rdoc.uid,
|
||||
rdoc._id, rdoc.pid, accept, rdoc.score, rdoc.contest.type,
|
||||
),
|
||||
await contest.updateStatus(
|
||||
rdoc.domainId, rdoc.contest.tid, rdoc.uid,
|
||||
rdoc._id, rdoc.pid, accept, rdoc.score, rdoc.contest.type,
|
||||
);
|
||||
} else {
|
||||
tasks.push(domain.incUserInDomain(rdoc.domainId, rdoc.uid, 'nAccept', 1));
|
||||
}
|
||||
await Promise.all(tasks);
|
||||
} else if (updated) await domain.incUserInDomain(rdoc.domainId, rdoc.uid, 'nAccept', 1);
|
||||
if (accept && updated) await problem.inc(rdoc.domainId, rdoc.pid, 'nAccept', 1);
|
||||
}
|
||||
|
||||
export async function next(body: JudgeResultBody) {
|
||||
|
||||
Reference in new issue
Block a user