refactor(api): delete dead code (#58577)

This commit is contained in:
Oliver Eyton-Williams
2025-02-05 14:36:58 +01:00
committed by GitHub
parent 38d2e7d112
commit e048e903c3

View File

@@ -698,19 +698,16 @@ export const challengeRoutes: FastifyPluginCallbackTypebox = (
] as CompletedChallenge;
const oldResults = oldChallenge?.examResults as ExamResults;
const newChallenge = oldChallenge;
newChallenge ? (newChallenge.examResults = examResults) : null;
// only update if it's a better result
if (percentCorrect > oldResults.percentCorrect) {
const updatedChallege = {
const updatedChallenge = {
id,
challengeType: oldChallenge.challengeType,
completedDate: oldChallenge.completedDate,
examResults
};
newCompletedChallenges[alreadyCompletedIndex] = updatedChallege;
newCompletedChallenges[alreadyCompletedIndex] = updatedChallenge;
// TODO(Post-MVP): Try to DRY the updates.
// updateUserChallengeData, for all its faults, handles the