-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TECH] Extraire la sélection d'épreuves lors du scoring dans un servi…
- Loading branch information
Showing
24 changed files
with
391 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
api/src/certification/evaluation/domain/services/scoring/calibrated-challenge-service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import Debug from 'debug'; | ||
import differenceBy from 'lodash/differenceBy.js'; | ||
|
||
const debugScoringForV3Certification = Debug('pix:certif:v3:scoring'); | ||
|
||
export const findByCertificationCourseId = async ({ | ||
certificationCourseId, | ||
challengeCalibrationRepository, | ||
challengeRepository, | ||
}) => { | ||
const flashCompatibleChallenges = await challengeRepository.findFlashCompatibleWithoutLocale({ | ||
useObsoleteChallenges: true, | ||
}); | ||
debugScoringForV3Certification(`FlashCompatibleChallenges count: ${flashCompatibleChallenges.length}`); | ||
|
||
return _findByCertificationCourseId({ | ||
compatibleChallenges: flashCompatibleChallenges, | ||
certificationCourseId, | ||
challengeCalibrationRepository, | ||
challengeRepository, | ||
}); | ||
}; | ||
|
||
const _findByCertificationCourseId = async ({ | ||
compatibleChallenges, | ||
certificationCourseId, | ||
challengeCalibrationRepository, | ||
challengeRepository, | ||
}) => { | ||
const challengeCalibrations = await challengeCalibrationRepository.getByCertificationCourseId({ | ||
certificationCourseId, | ||
}); | ||
|
||
const askedChallenges = await challengeRepository.getMany(challengeCalibrations.map((challenge) => challenge.id)); | ||
|
||
_restoreCalibrationValues(challengeCalibrations, askedChallenges); | ||
|
||
const flashCompatibleChallengesNotAskedInCertification = differenceBy(compatibleChallenges, askedChallenges, 'id'); | ||
|
||
const allChallenges = [...askedChallenges, ...flashCompatibleChallengesNotAskedInCertification]; | ||
|
||
debugScoringForV3Certification( | ||
`Challenges after FlashCompatibleChallenges & CandidateAnswers merge count: ${allChallenges.length}`, | ||
); | ||
|
||
return { allChallenges, askedChallenges, challengeCalibrations }; | ||
}; | ||
|
||
function _restoreCalibrationValues(challengeCalibrations, askedChallenges) { | ||
challengeCalibrations.forEach((certificationChallenge) => { | ||
const askedChallenge = askedChallenges.find(({ id }) => id === certificationChallenge.id); | ||
askedChallenge.discriminant = certificationChallenge.discriminant; | ||
askedChallenge.difficulty = certificationChallenge.difficulty; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
api/src/certification/evaluation/domain/usecases/get-next-challenge-for-v2-certification.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
.../evaluation/infrastructure/repositories/certification-challenge-for-scoring-repository.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.