mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-30 03:03:06 -05:00
refactor(api): delete dead code (#58577)
This commit is contained in:
committed by
GitHub
parent
38d2e7d112
commit
e048e903c3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user