core: 修复自测不提供输入数据会进入评测流程的问题

This commit is contained in:
undefined committed 2021-02-05 17:25:17 +08:00
1 parent bb856bacce
commit 33aaf1f2ea
8 files changed
+20 -45

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ import {
const logger = new Logger('judge');
async function _postJudge(rdoc: Rdoc) {
if (typeof rdoc.input === 'string') return;
const accept = rdoc.status === builtin.STATUS.STATUS_ACCEPTED;
const tasks = [];
if (rdoc.contest) {
+1 -13
View File
@@ -226,18 +226,6 @@ export interface TestCase {
message: string,
}
export interface HackConfig {
hack: string,
}
export interface PretestConfig {
time?: string,
memory?: string,
input: string,
}
export type RunConfig = HackConfig | PretestConfig;
export interface ContestInfo {
type: 30 | 60,
tid: ObjectID,
@@ -262,7 +250,7 @@ export interface Rdoc {
status: number,
hidden: boolean,
progress?: number,
config?: RunConfig,
input?: string,
contest?: ContestInfo,
}
+7 -10
View File
@@ -7,7 +7,7 @@ import { STATUS } from './builtin';
import * as task from './task';
import * as problem from './problem';
import {
Rdoc, TestCase, RunConfig, ContestInfo, ProblemConfig,
Rdoc, TestCase, ContestInfo, ProblemConfig,
} from '../interface';
import { Time } from '../utils';
import * as bus from '../service/bus';
@@ -94,7 +94,7 @@ export async function judge(domainId: string, rid: ObjectID, priority = 1) {
export async function add(
domainId: string, pid: number, uid: number,
lang: string, code: string, addTask: boolean, contestOrConfig?: ContestInfo | RunConfig,
lang: string, code: string, addTask: boolean, contestOrConfig?: ContestInfo | string,
) {
const data: Rdoc = {
status: STATUS.STATUS_WAITING,
@@ -115,14 +115,11 @@ export async function add(
judgeAt: null,
rejudged: false,
};
if (contestOrConfig) {
if ((contestOrConfig as ContestInfo).type) {
data.contest = contestOrConfig as ContestInfo;
} else {
data.config = contestOrConfig as RunConfig;
data.hidden = true;
}
}
if (typeof contestOrConfig === 'string') {
// is Run
data.input = contestOrConfig;
data.hidden = true;
} else data.contest = contestOrConfig;
const res = await coll.insertOne(data);
if (addTask) await judge(domainId, res.insertedId);
return res.insertedId;