refactor: use challengeTypes instead of magic numbers (#51373)

This commit is contained in:
Muhammed Mustafa 2023-08-28 19:07:49 +03:00 committed by GitHub
parent c96b8bd462
commit 39672e14f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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