diff --git a/api/db/database-builder/factory/build-certification-candidate.js b/api/db/database-builder/factory/build-certification-candidate.js index 6ed96478b28..062c2ed0423 100644 --- a/api/db/database-builder/factory/build-certification-candidate.js +++ b/api/db/database-builder/factory/build-certification-candidate.js @@ -27,6 +27,7 @@ const buildCertificationCandidate = function ({ billingMode = null, prepaymentCode = null, hasSeenCertificationInstructions = false, + accessibilityAdjustmentNeeded = false, } = {}) { sessionId = _.isUndefined(sessionId) ? buildSession().id : sessionId; userId = _.isUndefined(userId) ? buildUser().id : userId; @@ -54,6 +55,7 @@ const buildCertificationCandidate = function ({ billingMode, prepaymentCode, hasSeenCertificationInstructions, + accessibilityAdjustmentNeeded, }; databaseBuffer.pushInsertable({ @@ -84,6 +86,7 @@ const buildCertificationCandidate = function ({ billingMode, prepaymentCode, hasSeenCertificationInstructions, + accessibilityAdjustmentNeeded, }; }; diff --git a/api/db/migrations/20240807091800_add_accessibility_adjusted_certification_needed_column_to_certification_candidates.js b/api/db/migrations/20240807091800_add_accessibility_adjusted_certification_needed_column_to_certification_candidates.js new file mode 100644 index 00000000000..4b6a1373882 --- /dev/null +++ b/api/db/migrations/20240807091800_add_accessibility_adjusted_certification_needed_column_to_certification_candidates.js @@ -0,0 +1,16 @@ +const TABLE_NAME = 'certification-candidates'; +const COLUMN_NAME = 'accessibilityAdjustmentNeeded'; + +const up = async function (knex) { + await knex.schema.table(TABLE_NAME, function (table) { + table.boolean(COLUMN_NAME).defaultTo(false); + }); +}; + +const down = async function (knex) { + await knex.schema.table(TABLE_NAME, function (table) { + table.dropColumn(COLUMN_NAME); + }); +}; + +export { down, up }; diff --git a/api/db/seeds/data/common/tooling/session-tooling.js b/api/db/seeds/data/common/tooling/session-tooling.js index 4cb41c02b18..38f7075daeb 100644 --- a/api/db/seeds/data/common/tooling/session-tooling.js +++ b/api/db/seeds/data/common/tooling/session-tooling.js @@ -38,6 +38,7 @@ export { * @param {Date} createdAt * @param {string} supervisorPassword * @param {learnersToRegisterCount: number, maxLevel: number } configSession + * @param {number} version * @returns {Promise<{sessionId: number}>} sessionId */ @@ -57,6 +58,7 @@ async function createDraftScoSession({ createdAt, configSession, supervisorPassword, + version, }) { _buildSession({ databaseBuilder, @@ -82,6 +84,7 @@ async function createDraftScoSession({ juryCommentAuthorId: null, juryCommentedAt: null, supervisorPassword, + version, }); await _registerOrganizationLearnersToSession({ @@ -90,6 +93,7 @@ async function createDraftScoSession({ organizationId, hasJoinSession: false, configSession, + version, }); await databaseBuilder.commit(); @@ -168,6 +172,7 @@ async function createDraftSession({ hasJoinSession: false, configSession, certificationCenterId, + version, }); await databaseBuilder.commit(); @@ -519,6 +524,7 @@ async function createPublishedSession({ hasJoinSession: true, configSession, certificationCenterId, + version, }); const { coreProfileData, complementaryCertificationsProfileData } = await _makeCandidatesCertifiable({ @@ -547,6 +553,7 @@ async function _registerOrganizationLearnersToSession({ organizationId, hasJoinSession, configSession, + version, }) { const certificationCandidates = []; if (_hasLearnersToRegister(configSession)) { @@ -560,6 +567,7 @@ async function _registerOrganizationLearnersToSession({ sessionId, extraTimePercentages, hasJoinSession, + version, ); } return certificationCandidates; @@ -572,6 +580,7 @@ function _addCertificationCandidatesToScoSession( sessionId, extraTimePercentages, hasJoinSession, + version, ) { organizationLearners.forEach((organizationLearner, index) => { const candidate = databaseBuilder.factory.buildCertificationCandidate({ @@ -593,6 +602,7 @@ function _addCertificationCandidatesToScoSession( authorizedToStart: false, billingMode: null, prepaymentCode: null, + accessibilityAdjustmentNeeded: version === 3 && index === 0, }); databaseBuilder.factory.buildCoreSubscription({ certificationCandidateId: candidate.id }); certificationCandidates.push(candidate); @@ -616,6 +626,7 @@ async function _registerCandidatesToSession({ hasJoinSession, configSession, certificationCenterId, + version, }) { const certificationCandidates = []; if (_hasCertificationCandidatesToRegister(configSession)) { @@ -678,6 +689,7 @@ async function _registerCandidatesToSession({ authorizedToStart: false, billingMode: randomBillingMode, prepaymentCode: randomPrepaymentCode, + accessibilityAdjustmentNeeded: version === 3 && i === 0, }); databaseBuilder.factory.buildCoreSubscription({ certificationCandidateId: certificationCandidate.id }); diff --git a/api/db/seeds/data/team-certification/data-builder.js b/api/db/seeds/data/team-certification/data-builder.js index 36d8eac7765..b210be935fb 100644 --- a/api/db/seeds/data/team-certification/data-builder.js +++ b/api/db/seeds/data/team-certification/data-builder.js @@ -112,6 +112,7 @@ async function _createScoCertificationCenter({ databaseBuilder }) { updatedAt: new Date(), members: [{ id: SCO_CERTIFICATION_MANAGING_STUDENTS_CERTIFICATION_CENTER_USER_ID }], complementaryCertificationIds: [], + isV3Pilot: true, }); } @@ -306,6 +307,7 @@ async function _createScoSession({ databaseBuilder }) { room: '42', time: '12:00', createdAt: new Date(), + version: 3, configSession: { learnersToRegisterCount: 8, }, @@ -427,7 +429,7 @@ async function _createSuccessCertifiableUser({ databaseBuilder }) { async function _createV3Session({ databaseBuilder, configSession = { - candidatesToRegisterCount: 1, + candidatesToRegisterCount: 2, hasComplementaryCertificationsToRegister: false, }, }) { diff --git a/api/src/shared/domain/models/CertificationCandidate.js b/api/src/shared/domain/models/CertificationCandidate.js index ece0c9771fa..79082f0b9d7 100644 --- a/api/src/shared/domain/models/CertificationCandidate.js +++ b/api/src/shared/domain/models/CertificationCandidate.js @@ -44,6 +44,7 @@ const certificationCandidateParticipationJoiSchema = Joi.object({ prepaymentCode: Joi.string().allow(null).optional(), subscriptions: Joi.array().items(subscriptionSchema).unique('type').required(), hasSeenCertificationInstructions: Joi.boolean().optional(), + accessibilityAdjustmentNeeded: Joi.boolean().optional(), }); class CertificationCandidate { @@ -78,6 +79,7 @@ class CertificationCandidate { prepaymentCode = null, subscriptions = [], hasSeenCertificationInstructions = false, + accessibilityAdjustmentNeeded = false, } = {}) { this.id = id; this.firstName = firstName; @@ -102,6 +104,7 @@ class CertificationCandidate { this.billingMode = billingMode; this.prepaymentCode = prepaymentCode; this.hasSeenCertificationInstructions = hasSeenCertificationInstructions; + this.accessibilityAdjustmentNeeded = accessibilityAdjustmentNeeded; Object.defineProperty(this, 'complementaryCertification', { enumerable: true, diff --git a/api/tests/certification/enrolment/integration/infrastructure/repositories/candidate-repository_test.js b/api/tests/certification/enrolment/integration/infrastructure/repositories/candidate-repository_test.js index 434864d615a..aeea84d7e79 100644 --- a/api/tests/certification/enrolment/integration/infrastructure/repositories/candidate-repository_test.js +++ b/api/tests/certification/enrolment/integration/infrastructure/repositories/candidate-repository_test.js @@ -151,6 +151,7 @@ describe('Integration | Certification | Session | Repository | Candidate', funct billingMode: null, prepaymentCode: null, hasSeenCertificationInstructions: false, + accessibilityAdjustmentNeeded: false, subscriptions: [ { type: SUBSCRIPTION_TYPES.CORE, diff --git a/api/tests/tooling/domain-builder/factory/build-certification-candidate.js b/api/tests/tooling/domain-builder/factory/build-certification-candidate.js index e9bf35802c9..1f9f604fd49 100644 --- a/api/tests/tooling/domain-builder/factory/build-certification-candidate.js +++ b/api/tests/tooling/domain-builder/factory/build-certification-candidate.js @@ -25,6 +25,7 @@ const buildCertificationCandidate = function ({ billingMode = null, prepaymentCode = null, subscriptions = [domainBuilder.buildCoreSubscription({ certificationCandidateId: 123 })], + accessibilityAdjustmentNeeded = false, } = {}) { return new CertificationCandidate({ id, @@ -50,6 +51,7 @@ const buildCertificationCandidate = function ({ billingMode, prepaymentCode, subscriptions, + accessibilityAdjustmentNeeded, }); }; diff --git a/api/tests/unit/domain/models/CertificationCandidate_test.js b/api/tests/unit/domain/models/CertificationCandidate_test.js index ff441f9338a..2b9fa8c7f47 100644 --- a/api/tests/unit/domain/models/CertificationCandidate_test.js +++ b/api/tests/unit/domain/models/CertificationCandidate_test.js @@ -48,6 +48,7 @@ describe('Unit | Domain | Models | Certification Candidate', function () { complementaryCertification: null, subscriptions: [coreSubscription], hasSeenCertificationInstructions: false, + accessibilityAdjustmentNeeded: false, }; });