Skip to content

Commit

Permalink
WIP ✨ api: V2 scoring must find the competences used during certifica…
Browse files Browse the repository at this point in the history
…tion challenges selection
  • Loading branch information
Steph0 committed Nov 15, 2024
1 parent c0c57d6 commit 349df92
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @typedef {import('../index.js').AssessmentResultRepository} AssessmentResultRepository
* @typedef {import('../index.js').CertificationCourseRepository} CertificationCourseRepository
* @typedef {import('../index.js').CompetenceMarkRepository} CompetenceMarkRepository
* @typedef {import('../index.js').CertificationCandidateRepository} CertificationCandidateRepository
* @typedef {import('../index.js').ScoringDegradationService} ScoringDegradationService
* @typedef {import('../index.js').ScoringCertificationService} ScoringCertificationService
* @typedef {import('../index.js').ScoringService} ScoringService
Expand Down Expand Up @@ -36,6 +37,7 @@ import { AlgorithmEngineVersion } from '../../../../shared/domain/models/Algorit
* @param {AreaRepository} params.areaRepository
* @param {PlacementProfileService} params.placementProfileService
* @param {ScoringService} params.scoringService
* @param {CertificationCandidateRepository} params.certificationCandidateRepository
* @param {Object} params.dependencies
* @param {calculateCertificationAssessmentScore} params.dependencies.calculateCertificationAssessmentScore
*/
Expand All @@ -50,13 +52,15 @@ export const handleV2CertificationScoring = async ({
areaRepository,
placementProfileService,
scoringService,
certificationCandidateRepository,
dependencies = { calculateCertificationAssessmentScore },
}) => {
const certificationAssessmentScore = await dependencies.calculateCertificationAssessmentScore({
certificationAssessment,
areaRepository,
placementProfileService,
scoringService,
certificationCandidateRepository,
});
const certificationCourse = await certificationCourseRepository.get({
id: certificationAssessment.certificationCourseId,
Expand Down Expand Up @@ -85,17 +89,23 @@ export const handleV2CertificationScoring = async ({
/**
* @param {Object} params
* @param {CertificationAssessment} params.certificationAssessment
* @param {ScoringService} params.dependencies.scoringService
* @param {ScoringService} params.scoringService
* @param {CertificationCandidateRepository} params.certificationCandidateRepository
*/
export const calculateCertificationAssessmentScore = async function ({
certificationAssessment,
areaRepository,
placementProfileService,
scoringService,
certificationCandidateRepository,
}) {
const candidate = await certificationCandidateRepository.findByAssessmentId({
assessmentId: certificationAssessment.id,
});

const testedCompetences = await _getTestedCompetences({
userId: certificationAssessment.userId,
limitDate: certificationAssessment.createdAt,
limitDate: candidate.reconciledAt,
version: AlgorithmEngineVersion.V2,
placementProfileService,
});
Expand Down
Loading

0 comments on commit 349df92

Please sign in to comment.