Skip to content

Commit

Permalink
Merge pull request #958 from tsg-ut/nmpz-fix-judge-logic
Browse files Browse the repository at this point in the history
nmpz: fix judge
  • Loading branch information
sh-mug authored Oct 24, 2024
2 parents 656668d + 08ec026 commit 9179029
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nmpz/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import puppeteer from "puppeteer";
import sqlite3 from "sqlite3";
import { increment } from '../achievements';
import { AteQuizProblem } from "../atequiz";
import { normalize } from "../hayaoshi";
import logger from "../lib/logger";
import type { SlackInterface } from "../lib/slack";
const { Mutex } = require("async-mutex");
Expand Down Expand Up @@ -229,7 +230,11 @@ class NmpzAteQuiz extends AteQuiz {
}

judge(answer: string, _user: string) {
return answer.toLowerCase() === this.problem.answer.toLowerCase();
const normalizedAnswer = normalize(answer);
const normalizedCorrectAnswers = this.problem.correctAnswers.map(normalize);
return normalizedCorrectAnswers.some(
(normalizedCorrectAnswer: string): boolean => normalizedAnswer === normalizedCorrectAnswer
);
}

waitSecGen(hintIndex: number): number {
Expand Down

0 comments on commit 9179029

Please sign in to comment.