judge: support multi answers (#401, issue #397)

pull/405/head
panda 2 years ago committed by GitHub
parent 784180c0a9
commit 1ba52c5a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
{ {
"name": "@hydrooj/hydrojudge", "name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js", "bin": "bin/hydrojudge.js",
"version": "2.22.5", "version": "2.22.6",
"main": "package.json", "main": "package.json",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",

@ -38,8 +38,9 @@ export async function judge({
time: 0, time: 0,
memory: 0, memory: 0,
}; };
if (typeof ansInfo[0] === 'string') { if (typeof answers[key] === 'string') {
if (ansInfo[0]?.trim() === (answers[key] as any)?.trim()) { const stdAns = typeof ansInfo[0] === 'string' ? [ansInfo[0]] : ansInfo[0];
if (stdAns.some((ans) => ans.trim() === (answers[key] as any)?.trim())) {
totalScore += score; totalScore += score;
totalStatus = Math.max(totalStatus, STATUS.STATUS_ACCEPTED); totalStatus = Math.max(totalStatus, STATUS.STATUS_ACCEPTED);
next({ next({

Loading…
Cancel
Save