统一PostJudge接口

This commit is contained in:
undefined committed 2020-07-18 13:10:04 +08:00
1 parent 0ee306d0cf
commit 9efcdf9441
9 files changed
+108 -166

No files matched your search

+8 -1
View File
@@ -254,6 +254,7 @@ class ProblemPretestConnectionHandler extends ConnectionHandler {
@param('pid', Types.String)
async prepare(domainId: string, pid: string) {
const pdoc = await problem.get(domainId, pid);
if (pdoc.hidden) this.checkPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN);
if (!pdoc) throw new ProblemNotFoundError(domainId, pid);
this.pid = pdoc.docId.toString();
this.domainId = domainId;
@@ -261,12 +262,18 @@ class ProblemPretestConnectionHandler extends ConnectionHandler {
}
async onRecordChange(data) {
const rdoc: Rdoc = data.value;
const rdoc: Rdoc = data.value.rdoc;
if (
rdoc.uid !== this.user._id
|| rdoc.pid.toString() !== this.pid
|| rdoc.domainId !== this.domainId
) return;
rdoc.compilerTexts = [];
rdoc.judgeTexts = [];
// @ts-ignore
rdoc.testCases = rdoc.testCases.map((c) => ({
status: c.status,
}));
if (rdoc.tid) return;
this.send({ rdoc });
}