diff --git a/api/src/certification/flash-certification/application/scenario-simulator-controller.js b/api/src/certification/flash-certification/application/scenario-simulator-controller.js index 4ffdfc4879f..a95ec5383dc 100644 --- a/api/src/certification/flash-certification/application/scenario-simulator-controller.js +++ b/api/src/certification/flash-certification/application/scenario-simulator-controller.js @@ -64,6 +64,7 @@ async function simulateFlashAssessmentScenario( errorRate: answer.errorRate, answerStatus: answer.answerStatus, capacity: answer.capacity, + numberOfAvailableChallenges: answer.numberOfAvailableChallenges, })), }) + '\n'; } diff --git a/api/src/certification/flash-certification/domain/models/AssessmentSimulatorSingleMeasureStrategy.js b/api/src/certification/flash-certification/domain/models/AssessmentSimulatorSingleMeasureStrategy.js index a68d6ad3ba0..93564f39400 100644 --- a/api/src/certification/flash-certification/domain/models/AssessmentSimulatorSingleMeasureStrategy.js +++ b/api/src/certification/flash-certification/domain/models/AssessmentSimulatorSingleMeasureStrategy.js @@ -60,6 +60,7 @@ export class AssessmentSimulatorSingleMeasureStrategy { capacity, reward, answerStatus, + numberOfAvailableChallenges: possibleChallenges.length, }, ], challengeAnswers: [newAnswer], diff --git a/api/tests/acceptance/application/scenario-simulator/scenario-simulator-controller_test.js b/api/tests/acceptance/application/scenario-simulator/scenario-simulator-controller_test.js index 9b1bb68bb9f..a462f7073c9 100644 --- a/api/tests/acceptance/application/scenario-simulator/scenario-simulator-controller_test.js +++ b/api/tests/acceptance/application/scenario-simulator/scenario-simulator-controller_test.js @@ -165,6 +165,7 @@ describe('Acceptance | Controller | scenario-simulator-controller', function () expect(parsedResponse[0].simulationReport[0].reward).to.exist; expect(parsedResponse[0].simulationReport[0].errorRate).to.exist; expect(parsedResponse[0].simulationReport[0].answerStatus).to.exist; + expect(parsedResponse[0].simulationReport[0].numberOfAvailableChallenges).to.exist; }); describe('when there is no connected user', function () { diff --git a/api/tests/certification/flash-certification/integration/application/scenario-simulator-controller_test.js b/api/tests/certification/flash-certification/integration/application/scenario-simulator-controller_test.js index cae2c96d631..8c759e91d2e 100644 --- a/api/tests/certification/flash-certification/integration/application/scenario-simulator-controller_test.js +++ b/api/tests/certification/flash-certification/integration/application/scenario-simulator-controller_test.js @@ -21,19 +21,6 @@ describe('Integration | Application | scenario-simulator-controller', function ( sinon.stub(pickAnswerStatusService, 'pickAnswerStatusForCapacity'); sinon.stub(pickChallengeService, 'chooseNextChallenge'); - challenge1 = domainBuilder.buildChallenge({ id: 'chall1', successProbabilityThreshold: 0.65 }); - reward1 = 0.2; - errorRate1 = 0.3; - capacity1 = 0.4; - simulationResults = [ - { - challenge: challenge1, - reward: reward1, - errorRate: errorRate1, - capacity: capacity1, - }, - ]; - httpTestServer = new HttpTestServer(); await httpTestServer.register(moduleUnderTest); }); @@ -52,9 +39,11 @@ describe('Integration | Application | scenario-simulator-controller', function ( errorRate: errorRate1, capacity: capacity1, answerStatus: 'ok', + numberOfAvailableChallenges: 1, }, ]; }); + context('When configuring the challenge pick probability', function () { it('should call simulateFlashAssessmentScenario usecase with correct arguments', async function () { // given @@ -108,6 +97,7 @@ describe('Integration | Application | scenario-simulator-controller', function ( reward: reward1, difficulty: challenge1.difficulty, discriminant: challenge1.discriminant, + numberOfAvailableChallenges: 1, }, ], }, @@ -164,6 +154,7 @@ describe('Integration | Application | scenario-simulator-controller', function ( reward: reward1, difficulty: challenge1.difficulty, discriminant: challenge1.discriminant, + numberOfAvailableChallenges: 1, }, ], }, @@ -221,6 +212,7 @@ describe('Integration | Application | scenario-simulator-controller', function ( reward: reward1, difficulty: challenge1.difficulty, discriminant: challenge1.discriminant, + numberOfAvailableChallenges: 1, }, ], }, diff --git a/api/tests/certification/flash-certification/unit/domain/models/AssessmentSimulatorSingleMeasureStrategy_test.js b/api/tests/certification/flash-certification/unit/domain/models/AssessmentSimulatorSingleMeasureStrategy_test.js index 2fc78a78519..ebabd23e190 100644 --- a/api/tests/certification/flash-certification/unit/domain/models/AssessmentSimulatorSingleMeasureStrategy_test.js +++ b/api/tests/certification/flash-certification/unit/domain/models/AssessmentSimulatorSingleMeasureStrategy_test.js @@ -111,6 +111,7 @@ describe('Unit | Domain | Models | AssessmentSimulatorSingleMeasureStrategy', fu errorRate: expectedErrorRate, reward: expectedReward, answerStatus: answerForSimulator, + numberOfAvailableChallenges: 2, }, ], challengeAnswers: [ @@ -248,6 +249,7 @@ describe('Unit | Domain | Models | AssessmentSimulatorSingleMeasureStrategy', fu errorRate: expectedErrorRate, reward: expectedReward, answerStatus: answerForSimulator, + numberOfAvailableChallenges: 2, }, ], challengeAnswers: [