core: fix pretest

This commit is contained in:
undefined committed 2021-10-29 16:55:04 +08:00
1 parent 84f419f6f0
commit 2dd9168817
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -388,7 +388,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
if (this.response.body.pdoc.config?.langs && !this.response.body.pdoc.config.langs.includes(lang)) {
throw new BadRequestError('Language not allowed.');
}
if (pretest && this.response.body.pdoc.config?.type !== 'default') throw new BadRequestError('unable to run pretest');
if (pretest && !['default', 'fileio'].includes(this.response.body.pdoc.config?.type)) throw new BadRequestError('unable to run pretest');
await this.limitRate('add_record', 60, system.get('limit.submission'));
const rid = await record.add(domainId, this.pdoc.docId, this.user._id, lang, code, true, pretest ? input : tid, !pretest);
const rdoc = await record.get(domainId, rid);