mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): always use the same logic when saving challenges (#64553)
This commit is contained in:
committed by
GitHub
parent
6fc07e3561
commit
001f884e21
@@ -901,7 +901,13 @@ describe('challengeRoutes', () => {
|
||||
alreadyCompleted: false,
|
||||
points: 1,
|
||||
completedDate,
|
||||
savedChallenges: []
|
||||
savedChallenges: [
|
||||
{
|
||||
files: jsFiles,
|
||||
id: JsProjectId,
|
||||
lastSavedDate: expect.any(Number)
|
||||
}
|
||||
]
|
||||
});
|
||||
expect(response.statusCode).toBe(200);
|
||||
});
|
||||
@@ -1089,7 +1095,13 @@ describe('challengeRoutes', () => {
|
||||
alreadyCompleted: false,
|
||||
points: 1,
|
||||
completedDate,
|
||||
savedChallenges: []
|
||||
savedChallenges: [
|
||||
{
|
||||
files: jsFiles,
|
||||
id: JsProjectId,
|
||||
lastSavedDate: expect.any(Number)
|
||||
}
|
||||
]
|
||||
});
|
||||
expect(response.statusCode).toBe(200);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
formatCoderoadChallengeCompletedValidation,
|
||||
formatProjectCompletedValidation
|
||||
} from '../../utils/error-formatting.js';
|
||||
import { challenges } from '../../utils/get-challenges.js';
|
||||
import { challenges, savableChallenges } from '../../utils/get-challenges.js';
|
||||
import { ProgressTimestamp, getPoints } from '../../utils/progress.js';
|
||||
import {
|
||||
validateExamFromDbSchema,
|
||||
@@ -1128,10 +1128,7 @@ async function postSaveChallenge(
|
||||
files
|
||||
};
|
||||
|
||||
if (
|
||||
!multifileCertProjectIds.includes(challengeId) &&
|
||||
!multifilePythonCertProjectIds.includes(challengeId)
|
||||
) {
|
||||
if (!savableChallenges.has(challengeId)) {
|
||||
logger.warn(
|
||||
{
|
||||
challengeId
|
||||
|
||||
@@ -194,10 +194,7 @@ export async function updateUserChallengeData(
|
||||
? [...progressTimestamps, newProgressTimeStamp]
|
||||
: progressTimestamps;
|
||||
|
||||
if (
|
||||
multifileCertProjectIds.includes(challengeId) ||
|
||||
multifilePythonCertProjectIds.includes(challengeId)
|
||||
) {
|
||||
if (savableChallenges.has(challengeId)) {
|
||||
const challengeToSave: SavedChallenge = {
|
||||
id: challengeId,
|
||||
lastSavedDate: newProgressTimeStamp,
|
||||
|
||||
Reference in New Issue
Block a user