mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: 计量尝试人数而非提交量
suggested by @Menci
This commit is contained in:
1 parent
e5d715d02b
commit
e49ffa9f7b
17 files changed
+102
-138
No files matched your search
@@ -353,10 +353,12 @@ export class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
||||
type: document.TYPE_CONTEST,
|
||||
tid,
|
||||
});
|
||||
const pdomainId = typeof pid === 'string' ? pid.split(':')[0] : domainId;
|
||||
const ppid = typeof pid === 'number' ? pid : +pid.split(':')[1];
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
if (!pretest) {
|
||||
await Promise.all([
|
||||
problem.inc(domainId, pid, 'nSubmit', 1),
|
||||
(this.tsdoc.journal || []).filter((i) => i.pid === pid).length ? Promise.resolve() : problem.inc(pdomainId, ppid, 'nSubmit', 1),
|
||||
domain.incUserInDomain(domainId, this.user._id, 'nSubmit'),
|
||||
contest.updateStatus(domainId, tid, this.user._id, rid, pid),
|
||||
]);
|
||||
|
||||
@@ -233,7 +233,7 @@ class HomeworkDetailProblemSubmitHandler extends HomeworkDetailProblemHandler {
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
if (pretest) {
|
||||
await Promise.all([
|
||||
problem.inc(pdomainId, ppid, 'nSubmit', 1),
|
||||
(this.tsdoc.journal || []).filter((i) => i.pid === pid).length ? Promise.resolve() : problem.inc(pdomainId, ppid, 'nSubmit', 1),
|
||||
domain.incUserInDomain(domainId, this.user._id, 'nSubmit'),
|
||||
contest.updateStatus(domainId, tid, this.user._id,
|
||||
rid, pid, false, 0, document.TYPE_HOMEWORK),
|
||||
|
||||
@@ -35,9 +35,7 @@ export async function postJudge(rdoc: RecordDoc) {
|
||||
? await problem.inc(rdoc.pdomain, rdoc.pid, 'nAccept', 1)
|
||||
: await problem.get(rdoc.pdomain, rdoc.pid);
|
||||
const difficulty = difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept);
|
||||
if (!updated) await record.updateMulti(rdoc.domainId, { uid: rdoc.uid, status: builtin.STATUS.STATUS_ACCEPTED }, { effective: false });
|
||||
await Promise.all([
|
||||
record.update(rdoc.domainId, rdoc._id, { effective: true }),
|
||||
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),
|
||||
|
||||
@@ -257,7 +257,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
if (!pretest) {
|
||||
await Promise.all([
|
||||
problem.inc(domainId, this.pdoc.docId, 'nSubmit', 1),
|
||||
this.psdoc?.rid ? Promise.resolve() : problem.inc(domainId, this.pdoc.docId, 'nSubmit', 1),
|
||||
problem.incStatus(domainId, this.pdoc.docId, this.user._id, 'nSubmit', 1),
|
||||
domain.incUserInDomain(domainId, this.user._id, 'nSubmit'),
|
||||
]);
|
||||
|
||||
Reference in new issue
Block a user