From 4f3aa5e3c8729d412d93b4826fa1ba7f96f26144 Mon Sep 17 00:00:00 2001 From: flydog98 Date: Mon, 4 Dec 2023 12:26:32 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B8=B0=EC=A1=B4=20conditionCheck?= =?UTF-8?q?ers=20=EC=84=A0=EC=96=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#156] --- .../src/quiz-wizard/quiz-wizard.service.ts | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/backend/src/quiz-wizard/quiz-wizard.service.ts b/packages/backend/src/quiz-wizard/quiz-wizard.service.ts index c037c15..429d3d3 100644 --- a/packages/backend/src/quiz-wizard/quiz-wizard.service.ts +++ b/packages/backend/src/quiz-wizard/quiz-wizard.service.ts @@ -5,28 +5,8 @@ import { Magic } from './magic'; export class QuizWizardService { constructor(private magic: Magic) {} - private conditionCheckers = { - 1: (containerId: string) => this.checkCondition1(containerId), - 2: (containerId: string) => this.checkCondition2(containerId), - 3: (containerId: string) => this.checkCondition3(containerId), - 4: (containerId: string) => this.checkCondition4(containerId), - 5: (containerId: string) => this.checkCondition5(containerId), - 6: (containerId: string) => this.checkCondition6(containerId), - 7: (containerId: string) => this.checkCondition7(containerId), - 8: (containerId: string) => this.checkCondition8(containerId), - 9: (containerId: string) => this.checkCondition9(containerId), - 10: (containerId: string) => this.checkCondition10(containerId), - 11: (containerId: string) => this.checkCondition11(containerId), - 12: (containerId: string) => this.checkCondition12(containerId), - 13: (containerId: string) => this.checkCondition13(containerId), - 15: (containerId: string) => this.checkCondition15(containerId), - 16: (containerId: string) => this.checkCondition16(containerId), - 17: (containerId: string) => this.checkCondition17(containerId), - 19: (containerId: string) => this.checkCondition19(containerId), - }; - async submit(containerId: string, quizId: number) { - const checker = this.conditionCheckers[quizId]; + const checker = this[`checkCondition${quizId}`]; if (checker) { return await checker(containerId); }