Skip to content

Commit

Permalink
tech: add debug logs for get-next-challenge-for-v3-certification
Browse files Browse the repository at this point in the history
Co-authored-by: <[email protected]>
  • Loading branch information
HEYGUL committed Sep 19, 2024
1 parent bfc59cf commit 4b07ade
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
* @typedef {import('./index.js').CertificationCandidateForSupervisingRepository} CertificationCandidateForSupervisingRepository
*/

import Debug from 'debug';

import { AssessmentEndedError } from '../../../../shared/domain/errors.js';
import { CertificationChallenge, FlashAssessmentAlgorithm } from '../../../../shared/domain/models/index.js';

const debugGetNextChallengeForV3Certification = Debug('pix:certif:v3:get-next-challenge');

/**
* @param {Object} params
* @param {AnswerRepository} params.answerRepository
Expand Down Expand Up @@ -86,6 +90,11 @@ const getNextChallengeForV3Certification = async function ({
const challengesForCandidate = candidate.accessibilityAdjustmentNeeded
? challengesWithoutSkillsWithAValidatedLiveAlert.filter((challenge) => challenge.isAccessible)
: challengesWithoutSkillsWithAValidatedLiveAlert;
debugGetNextChallengeForV3Certification(
candidate.accessibilityAdjustmentNeeded
? `Candidate needs accessibility adjustment, possible challenges have been filtered (${challengesForCandidate.length} out of ${challengesWithoutSkillsWithAValidatedLiveAlert} selected`
: `Candidate does need any adjustment, all ${challengesWithoutSkillsWithAValidatedLiveAlert.length} have been selected`,
);

const possibleChallenges = assessmentAlgorithm.getPossibleNextChallenges({
assessmentAnswers: allAnswers,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'lodash';

import { Challenge } from '../../../../../../src/shared/domain/models/Challenge.js';
import { learningContentCache } from '../../../../../../src/shared/infrastructure/caches/learning-content-cache.js';
import { challengeDatasource } from '../../../../../../src/shared/infrastructure/datasources/learning-content/challenge-datasource.js';
import { LearningContentResourceNotFound } from '../../../../../../src/shared/infrastructure/datasources/learning-content/LearningContentResourceNotFound.js';
Expand Down

0 comments on commit 4b07ade

Please sign in to comment.