fix: update already completed challenge (#51017)

This commit is contained in:
Niraj Nandish
2023-07-25 23:42:37 +04:00
committed by GitHub
parent 2870ff2566
commit 29556804b0
+5 -8
View File
@@ -124,15 +124,12 @@ export async function updateUserChallengeData(
: null;
if (alreadyCompleted && oldChallenge) {
const challengeWithOldDate = userCompletedChallenges[oldIndex];
finalChallenge = {
...completedChallenge,
completedDate: oldChallenge.completedDate
};
if (challengeWithOldDate) {
challengeWithOldDate.completedDate = oldChallenge.completedDate;
finalChallenge = {
...completedChallenge,
...challengeWithOldDate
};
}
userCompletedChallenges[oldIndex] = finalChallenge;
} else {
finalChallenge = {
...completedChallenge