From 08ec026eff45316cee6f0a7c66a78a2958cd2703 Mon Sep 17 00:00:00 2001 From: sh-mug <52068539+sh-mug@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:35:12 +0000 Subject: [PATCH] nmpz: fix judge -- answer -> correctAnswers --- nmpz/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nmpz/index.ts b/nmpz/index.ts index 28c8b5f3..bf1cfb6f 100644 --- a/nmpz/index.ts +++ b/nmpz/index.ts @@ -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"); @@ -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 {