mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: objective: handle zero-question problem
This commit is contained in:
1 parent
3371f39ef4
commit
700de4fc9d
1 file changed
+2
@@ -2,6 +2,7 @@ import assert from 'assert';
|
|||||||
import { readFile } from 'fs-extra';
|
import { readFile } from 'fs-extra';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { STATUS } from '@hydrooj/utils/lib/status';
|
import { STATUS } from '@hydrooj/utils/lib/status';
|
||||||
|
import { FormatError } from '../error';
|
||||||
import { Context } from './interface';
|
import { Context } from './interface';
|
||||||
|
|
||||||
export async function judge({
|
export async function judge({
|
||||||
@@ -29,6 +30,7 @@ export async function judge({
|
|||||||
}
|
}
|
||||||
let totalScore = 0;
|
let totalScore = 0;
|
||||||
let totalStatus = 0;
|
let totalStatus = 0;
|
||||||
|
if (!Object.keys(answers).length) throw new FormatError('Invalid standard answer.');
|
||||||
for (const key in config.answers) {
|
for (const key in config.answers) {
|
||||||
const [subtaskId, caseId] = key.split('-').map(Number);
|
const [subtaskId, caseId] = key.split('-').map(Number);
|
||||||
const ansInfo = config.answers[key] as [string | string[], number];
|
const ansInfo = config.answers[key] as [string | string[], number];
|
||||||
|
|||||||
Reference in new issue
Block a user