mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix type check
This commit is contained in:
1 parent
0195ba361e
commit
00bdea78d2
1 file changed
+3
-3
@@ -13,9 +13,9 @@ export async function judge({
|
|||||||
: ('content' in code)
|
: ('content' in code)
|
||||||
? code.content.toString().replace(/\r/g, '')
|
? code.content.toString().replace(/\r/g, '')
|
||||||
: '';
|
: '';
|
||||||
let answers;
|
let answers: { [x: string]: string | string[] } = {};
|
||||||
try {
|
try {
|
||||||
answers = yaml.load(answer);
|
answers = yaml.load(answer) as { [x: string]: string | string[] };
|
||||||
assert(typeof answers === 'object');
|
assert(typeof answers === 'object');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return end({
|
return end({
|
||||||
@@ -39,7 +39,7 @@ export async function judge({
|
|||||||
memory: 0,
|
memory: 0,
|
||||||
};
|
};
|
||||||
if (typeof ansInfo[0] === 'string') {
|
if (typeof ansInfo[0] === 'string') {
|
||||||
if (ansInfo[0].trim() === answers[key].trim()) {
|
if (ansInfo[0].trim() === (answers[key] as string).trim()) {
|
||||||
totalScore += score;
|
totalScore += score;
|
||||||
totalStatus = Math.max(totalStatus, STATUS.STATUS_ACCEPTED);
|
totalStatus = Math.max(totalStatus, STATUS.STATUS_ACCEPTED);
|
||||||
next({
|
next({
|
||||||
|
|||||||
Reference in new issue
Block a user