Skip to content

Commit 6ed2dd9

Browse files
committed
tech(api): add published sco certification session in seeds
1 parent 6750fe8 commit 6ed2dd9

7 files changed

+48
-12
lines changed

api/db/seeds/data/common/tooling/organization-tooling.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async function createOrganization({
6464
features = [],
6565
configOrganization,
6666
parentOrganizationId,
67-
withOrganizationLearners = true,
6867
}) {
6968
organizationId = _buildOrganization({
7069
databaseBuilder,
@@ -109,13 +108,11 @@ async function createOrganization({
109108
features,
110109
});
111110

112-
if (withOrganizationLearners) {
113-
_buildOrganizationLearners({
114-
databaseBuilder,
115-
organizationId,
116-
configOrganization,
117-
});
118-
}
111+
_buildOrganizationLearners({
112+
databaseBuilder,
113+
organizationId,
114+
configOrganization,
115+
});
119116

120117
await databaseBuilder.commit();
121118
return { organizationId };

api/db/seeds/data/common/tooling/session-tooling.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import _ from 'lodash';
22

3+
import { SESSIONS_VERSIONS } from '../../../../../src/certification/shared/domain/models/SessionVersion.js';
34
import { Assessment } from '../../../../../src/shared/domain/models/Assessment.js';
45
import {
56
CLEA_COMPLEMENTARY_CERTIFICATION_ID,
@@ -381,6 +382,7 @@ async function createPublishedScoSession({
381382
juryCommentAuthorId,
382383
juryCommentedAt,
383384
invigilatorPassword,
385+
version: SESSIONS_VERSIONS.V3,
384386
});
385387
databaseBuilder.factory.buildFinalizedSession({
386388
sessionId,

api/db/seeds/data/team-certification/constants.js

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ const PRO_EXTERNAL_ID = 'PRO_EXTERNAL_ID';
4444
const SUP_EXTERNAL_ID = 'SUP_EXTERNAL_ID';
4545

4646
// SESSION IDS
47+
const TEAM_CERTIFICATION_OFFSET_ID_SESSIONS = TEAM_CERTIFICATION_OFFSET_ID + 400;
48+
const SCO_PUBLISHED_SESSION = TEAM_CERTIFICATION_OFFSET_ID_SESSIONS + 1;
49+
4750
const complementaryCertificationIds = [
4851
CLEA_COMPLEMENTARY_CERTIFICATION_ID,
4952
PIX_DROIT_COMPLEMENTARY_CERTIFICATION_ID,
@@ -74,6 +77,7 @@ export {
7477
SCO_MANAGING_STUDENTS_ORGANIZATION_ID,
7578
SCO_NOT_MANAGING_CERTIFICATION_CENTER_ID,
7679
SCO_NOT_MANAGING_STUDENTS_ORGANIZATION_ID,
80+
SCO_PUBLISHED_SESSION,
7781
SUP_CERTIFICATION_CENTER_ID,
7882
SUP_EXTERNAL_ID,
7983
TEAM_CERTIFICATION_OFFSET_ID_CENTERS,

api/db/seeds/data/team-certification/create-pro-organization-with-certif-center.js

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ async function _createProOrganization({ databaseBuilder }) {
4444
configOrganization: {
4545
learnerCount: 8,
4646
},
47-
withOrganizationLearners: false,
4847
});
4948
}
5049

api/db/seeds/data/team-certification/create-sco-organization-managing-agri-student-with-fregata.js

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ async function _createScoOrganization({ databaseBuilder }) {
4343
learnerCount: 8,
4444
},
4545
tagIds: [COLLEGE_TAG.id],
46-
withOrganizationLearners: false,
4746
});
4847
}
4948

api/db/seeds/data/team-certification/create-sco-organization-managing-student-with-siecle.js

+37-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import {
88
SCO_CERTIFICATION_MANAGING_STUDENTS_CERTIFICATION_CENTER_USER_ID,
99
SCO_CERTIFICATION_MANAGING_STUDENTS_ORGANIZATION_USER_ID,
1010
SCO_MANAGING_STUDENTS_ORGANIZATION_ID,
11+
SCO_PUBLISHED_SESSION,
1112
} from './constants.js';
1213

1314
export async function scoOrganizationManaginStudentsWithSiecle({ databaseBuilder }) {
1415
await _createScoOrganization({ databaseBuilder });
1516
await _createScoCertificationCenter({ databaseBuilder });
17+
await _createPublishedScoSession({ databaseBuilder });
1618
}
1719

1820
async function _createScoOrganization({ databaseBuilder }) {
@@ -43,7 +45,6 @@ async function _createScoOrganization({ databaseBuilder }) {
4345
learnerCount: 8,
4446
},
4547
tagIds: [COLLEGE_TAG.id],
46-
withOrganizationLearners: false,
4748
});
4849
}
4950

@@ -76,3 +77,38 @@ async function _createScoCertificationCenter({ databaseBuilder }) {
7677
isV3Pilot: true,
7778
});
7879
}
80+
81+
async function _createPublishedScoSession({ databaseBuilder }) {
82+
const sessionDate = new Date();
83+
84+
await tooling.session.createPublishedScoSession({
85+
databaseBuilder,
86+
sessionId: SCO_PUBLISHED_SESSION,
87+
certificationCenterId: SCO_CERTIFICATION_CENTER_ID,
88+
organizationId: SCO_MANAGING_STUDENTS_ORGANIZATION_ID,
89+
accessCode: 'SCOS34',
90+
address: '1 rue Certification sco',
91+
certificationCenter: 'Centre de certification sco managing students',
92+
date: sessionDate,
93+
description: 'une description',
94+
examiner: 'Un super examinateur',
95+
room: '42',
96+
time: '12:00',
97+
examinerGlobalComment: 'Session sans pb',
98+
hasIncident: false,
99+
hasJoiningIssue: false,
100+
createdAt: sessionDate,
101+
finalizedAt: sessionDate,
102+
resultsSentToPrescriberAt: sessionDate,
103+
publishedAt: sessionDate,
104+
assignedCertificationOfficerId: null,
105+
juryComment: '',
106+
juryCommentAuthorId: null,
107+
juryCommentedAt: sessionDate,
108+
configSession: {
109+
learnersToRegisterCount: 8,
110+
maxLevel: 3,
111+
sessionDate,
112+
},
113+
});
114+
}

api/db/seeds/data/team-certification/create-sco-organization-not-managing-students.js

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ async function _createScoOrganization({ databaseBuilder }) {
4343
learnerCount: 8,
4444
},
4545
tagIds: [COLLEGE_TAG.id],
46-
withOrganizationLearners: false,
4746
});
4847
}
4948

0 commit comments

Comments
 (0)