core: 优化AC量计算

- 比赛中不计入nAccept
- script.problemStat添加用户AC量统计
This commit is contained in:
undefined committed 2021-02-10 12:53:42 +08:00
1 parent 0ceb095314
commit fa1392fa4b
4 files changed
+56 -13

No files matched your search

+6 -8
View File
@@ -19,6 +19,10 @@ 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),
);
if (rdoc.contest) {
tasks.push(
contest.updateStatus(
@@ -26,14 +30,8 @@ async function _postJudge(rdoc: Rdoc) {
rdoc._id, rdoc.pid, accept, rdoc.score, rdoc.contest.type,
),
);
}
if (await problem.updateStatus(rdoc.domainId, rdoc.pid, rdoc.uid, rdoc._id, rdoc.status)) {
if (accept && !rdoc.rejudged) {
tasks.push(
problem.inc(rdoc.domainId, rdoc.pid, 'nAccept', 1),
domain.incUserInDomain(rdoc.domainId, rdoc.uid, 'nAccept', 1),
);
}
} else {
tasks.push(domain.incUserInDomain(rdoc.domainId, rdoc.uid, 'nAccept', 1));
}
await Promise.all(tasks);
}