From eea3d1da01c1898ed2b91e0b2dba144d51ddb1a9 Mon Sep 17 00:00:00 2001 From: P-Jeremy Date: Mon, 25 Nov 2024 16:09:14 +0100 Subject: [PATCH] :sparkles: api: add accessibilityAdjustmentNeeded param to simulator route Co-authored-by: Yannick Francois --- .../application/scenario-simulator-controller.js | 2 ++ .../application/scenario-simulator-route.js | 1 + .../domain/usecases/simulate-flash-assessment-scenario.js | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) 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 9d60a44d4b8..4ffdfc4879f 100644 --- a/api/src/certification/flash-certification/application/scenario-simulator-controller.js +++ b/api/src/certification/flash-certification/application/scenario-simulator-controller.js @@ -26,6 +26,7 @@ async function simulateFlashAssessmentScenario( challengePickProbability, variationPercent, capacity, + accessibilityAdjustmentNeeded, } = request.payload; const pickAnswerStatus = dependencies.pickAnswerStatusService.pickAnswerStatusForCapacity(capacity); @@ -45,6 +46,7 @@ async function simulateFlashAssessmentScenario( locale, initialCapacity, variationPercent, + accessibilityAdjustmentNeeded, }, _.isUndefined, ); 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 a5ebec53887..11a7b9caabb 100644 --- a/api/src/certification/flash-certification/application/scenario-simulator-route.js +++ b/api/src/certification/flash-certification/application/scenario-simulator-route.js @@ -26,6 +26,7 @@ const register = async (server) => { challengePickProbability: Joi.number().min(0).max(100), variationPercent: Joi.number().min(0).max(1), capacity: Joi.number().min(-8).max(8).required(), + accessibilityAdjustmentNeeded: Joi.boolean(), }) .required(), }, 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 73cb40ba744..b35b54413b3 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 @@ -12,8 +12,9 @@ export async function simulateFlashAssessmentScenario({ challengeRepository, flashAlgorithmService, sharedFlashAlgorithmConfigurationRepository, + accessibilityAdjustmentNeeded, }) { - const challenges = await challengeRepository.findActiveFlashCompatible({ locale }); + const challenges = await challengeRepository.findActiveFlashCompatible({ locale, accessibilityAdjustmentNeeded }); const configurationUsedInProduction = await sharedFlashAlgorithmConfigurationRepository.getMostRecent();