From 39672e14f766be13ec8e4287905c7b59e6f73ee2 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 28 Aug 2023 19:07:49 +0300 Subject: [PATCH] refactor: use challengeTypes instead of magic numbers (#51373) --- api/src/routes/challenge.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/routes/challenge.ts b/api/src/routes/challenge.ts index 6601b17da39..8cb6693b94b 100644 --- a/api/src/routes/challenge.ts +++ b/api/src/routes/challenge.ts @@ -86,7 +86,9 @@ export const challengeRoutes: FastifyPluginCallbackTypebox = ( } const codeRoadChallenges = challenges.filter( - ({ challengeType }) => challengeType === 12 || challengeType === 13 + ({ challengeType }) => + challengeType === challengeTypes.codeAllyPractice || + challengeType === challengeTypes.codeAllyCert ); const challenge = codeRoadChallenges.find(challenge => { @@ -131,7 +133,7 @@ export const challengeRoutes: FastifyPluginCallbackTypebox = ( challenge => challenge.id === challengeId ); - if (challengeType === 13 && !isCompleted) { + if (challengeType === challengeTypes.codeAllyCert && !isCompleted) { const finalChallenge = { id: challengeId, completedDate