judge: objective: handle zero-question problem

This commit is contained in:
undefined committed 2022-11-14 20:20:37 +08:00
1 parent 3371f39ef4
commit 700de4fc9d
1 file changed
+2
@@ -2,6 +2,7 @@ import assert from 'assert';
import { readFile } from 'fs-extra';
import yaml from 'js-yaml';
import { STATUS } from '@hydrooj/utils/lib/status';
import { FormatError } from '../error';
import { Context } from './interface';
export async function judge({
@@ -29,6 +30,7 @@ export async function judge({
}
let totalScore = 0;
let totalStatus = 0;
if (!Object.keys(answers).length) throw new FormatError('Invalid standard answer.');
for (const key in config.answers) {
const [subtaskId, caseId] = key.split('-').map(Number);
const ansInfo = config.answers[key] as [string | string[], number];