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 6626f5d0f0e..ff7d4c3867a 100644 --- a/api/src/certification/flash-certification/application/scenario-simulator-controller.js +++ b/api/src/certification/flash-certification/application/scenario-simulator-controller.js @@ -22,7 +22,6 @@ async function simulateFlashAssessmentScenario( }, ) { const { - stopAtChallenge, initialCapacity, numberOfIterations = 1, challengePickProbability, @@ -52,7 +51,6 @@ async function simulateFlashAssessmentScenario( pickAnswerStatus, pickChallenge, locale, - stopAtChallenge, initialCapacity, challengesBetweenSameCompetence, limitToOneQuestionPerTube, diff --git a/api/src/certification/flash-certification/application/scenario-simulator-route.js b/api/src/certification/flash-certification/application/scenario-simulator-route.js index ecf9e86ff2d..0a306262a53 100644 --- a/api/src/certification/flash-certification/application/scenario-simulator-route.js +++ b/api/src/certification/flash-certification/application/scenario-simulator-route.js @@ -11,7 +11,6 @@ const _successRatesConfigurationValidator = Joi.object({ const _baseScenarioParametersValidator = Joi.object().keys({ initialCapacity: Joi.number().integer().min(-8).max(8), - stopAtChallenge: Joi.number().integer().min(0), numberOfIterations: Joi.number().integer().min(0), challengePickProbability: Joi.number().min(0).max(100), challengesBetweenSameCompetence: Joi.number().min(0), diff --git a/api/src/certification/flash-certification/domain/usecases/simulate-flash-assessment-scenario.js b/api/src/certification/flash-certification/domain/usecases/simulate-flash-assessment-scenario.js index f8e965821ed..d113dfb9116 100644 --- a/api/src/certification/flash-certification/domain/usecases/simulate-flash-assessment-scenario.js +++ b/api/src/certification/flash-certification/domain/usecases/simulate-flash-assessment-scenario.js @@ -7,7 +7,6 @@ export async function simulateFlashAssessmentScenario({ locale, pickChallenge, pickAnswerStatus, - stopAtChallenge, initialCapacity, challengesBetweenSameCompetence = 0, limitToOneQuestionPerTube = true, @@ -31,7 +30,7 @@ export async function simulateFlashAssessmentScenario({ variationPercentUntil: undefined, doubleMeasuresUntil: 0, challengesBetweenSameCompetence, - maximumAssessmentLength: stopAtChallenge, + maximumAssessmentLength: configurationUsedInProduction.maximumAssessmentLength, }), }); 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 53db3317e61..b4815805084 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 @@ -15,25 +15,23 @@ const { describe('Acceptance | Controller | scenario-simulator-controller', function () { let server; let adminAuthorization; - let validCapacityPayload; - let stopAtChallenge; + let validPayload; beforeEach(async function () { const { id: adminId } = databaseBuilder.factory.buildUser.withRole({ role: SUPER_ADMIN, }); - stopAtChallenge = databaseBuilder.factory.buildFlashAlgorithmConfiguration({ + databaseBuilder.factory.buildFlashAlgorithmConfiguration({ maximumAssessmentLength: 2, createdAt: new Date('2022-02-01'), - }).maximumAssessmentLength; + }); adminAuthorization = generateValidRequestAuthorizationHeader(adminId); await databaseBuilder.commit(); - validCapacityPayload = { + validPayload = { capacity: 4.5, - stopAtChallenge, }; const learningContent = { @@ -151,10 +149,6 @@ describe('Acceptance | Controller | scenario-simulator-controller', function () describe('when a number of challenges to pass is specified', function () { it('should return a payload with the same number of simulation scenario results', async function () { // given - const validPayload = { - ...validCapacityPayload, - stopAtChallenge, - }; options.headers.authorization = adminAuthorization; options.payload = validPayload; @@ -179,7 +173,7 @@ describe('Acceptance | Controller | scenario-simulator-controller', function () it('should return a payload with simulation the capacity scenario results', async function () { // given options.headers.authorization = adminAuthorization; - options.payload = validCapacityPayload; + options.payload = validPayload; // when const response = await server.inject(options); @@ -209,7 +203,7 @@ describe('Acceptance | Controller | scenario-simulator-controller', function () const { id: userId } = databaseBuilder.factory.buildUser(); options.headers.authorization = generateValidRequestAuthorizationHeader(userId); await databaseBuilder.commit(); - options.payload = validCapacityPayload; + options.payload = validPayload; // when const response = await server.inject(options); diff --git a/api/tests/unit/domain/usecases/simulate-flash-assessment-scenario_test.js b/api/tests/unit/domain/usecases/simulate-flash-assessment-scenario_test.js index ef5da78b2b1..b1122875f79 100644 --- a/api/tests/unit/domain/usecases/simulate-flash-assessment-scenario_test.js +++ b/api/tests/unit/domain/usecases/simulate-flash-assessment-scenario_test.js @@ -26,7 +26,6 @@ describe('Unit | UseCase | simulate-flash-assessment-scenario', function () { // when const result = await simulateFlashAssessmentScenario({ - stopAtChallenge: 3, challengeRepository, locale, pickChallenge, @@ -73,7 +72,6 @@ describe('Unit | UseCase | simulate-flash-assessment-scenario', function () { // when const result = await simulateFlashAssessmentScenario({ - stopAtChallenge: 3, challengeRepository, sharedFlashAlgorithmConfigurationRepository, locale, @@ -141,7 +139,6 @@ describe('Unit | UseCase | simulate-flash-assessment-scenario', function () { // when const result = await simulateFlashAssessmentScenario({ - stopAtChallenge: 3, challengeRepository, sharedFlashAlgorithmConfigurationRepository, locale, @@ -187,7 +184,6 @@ describe('Unit | UseCase | simulate-flash-assessment-scenario', function () { // when const result = await simulateFlashAssessmentScenario({ - stopAtChallenge: 3, challengeRepository, sharedFlashAlgorithmConfigurationRepository, locale, @@ -337,7 +333,10 @@ function prepareStubs({ ), ); - sharedFlashAlgorithmConfigurationRepository.getMostRecent.resolves({ enablePassageByAllCompetences: true }); + sharedFlashAlgorithmConfigurationRepository.getMostRecent.resolves({ + enablePassageByAllCompetences: true, + maximumAssessmentLength: 3, + }); flashAlgorithmService.getCapacityAndErrorRate .withArgs({