mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: trigger record/change inside RecordModel
This commit is contained in:
2 files changed
+1
-4
No files matched your search
@@ -539,7 +539,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
domainId, this.pdoc.docId, this.user._id, lang, code, true,
|
||||
pretest ? { input, type: 'pretest' } : { contest: tid, files, type: 'judge' },
|
||||
);
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
if (!pretest) {
|
||||
await Promise.all([
|
||||
problem.inc(domainId, this.pdoc.docId, 'nSubmit', 1),
|
||||
@@ -548,7 +547,6 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
|
||||
tid && contest.updateStatus(domainId, tid, this.user._id, rid, this.pdoc.docId),
|
||||
]);
|
||||
}
|
||||
this.ctx.broadcast('record/change', rdoc);
|
||||
if (tid && !pretest && !contest.canShowSelfRecord.call(this, this.tdoc)) {
|
||||
this.response.body = { tid };
|
||||
this.response.redirect = this.url(this.tdoc.rule === 'homework' ? 'homework_detail' : 'contest_detail', { tid });
|
||||
@@ -607,9 +605,7 @@ export class ProblemHackHandler extends ProblemDetailHandler {
|
||||
this.rdoc.lang, this.rdoc.code, true,
|
||||
{ contest: tid, type: 'hack', files: { hack: `${id}#input.txt` } },
|
||||
);
|
||||
const rdoc = await record.get(domainId, rid);
|
||||
// TODO contest: update status;
|
||||
this.ctx.broadcast('record/change', rdoc);
|
||||
this.response.body = { rid };
|
||||
this.response.redirect = this.url('record_detail', { rid });
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ export default class RecordModel {
|
||||
data.contest = RecordModel.RECORD_PRETEST;
|
||||
}
|
||||
const res = await RecordModel.coll.insertOne(data);
|
||||
bus.broadcast('record/change', data);
|
||||
if (addTask) {
|
||||
const priority = await RecordModel.submissionPriority(uid, args.type === 'pretest' ? -20 : (isContest ? 50 : 0));
|
||||
await RecordModel.judge(domainId, res.insertedId, priority, isContest ? { detail: false } : {}, {
|
||||
|
||||
Reference in new issue
Block a user