diff --git a/backend/src/components/eas/eas.js b/backend/src/components/eas/eas.js index 471c3425..1eb4fae0 100644 --- a/backend/src/components/eas/eas.js +++ b/backend/src/components/eas/eas.js @@ -177,7 +177,6 @@ async function deleteAssessmentStudentByID(req, res) { } } - function includeAssessmentStudentProps(assessmentStudent) { if(assessmentStudent) { let school = cacheService.getSchoolBySchoolID(assessmentStudent.schoolID); diff --git a/backend/src/routes/eas.js b/backend/src/routes/eas.js index b7f41387..9d797e09 100644 --- a/backend/src/routes/eas.js +++ b/backend/src/routes/eas.js @@ -7,7 +7,7 @@ const extendSession = utils.extendSession(); const permUtils = require('../components/permissionUtils'); const perm = require('../util/Permission'); const validate = require('../components/validator'); -const {putStudentAssessmentSchema} = require('../validations/eas'); +const {putStudentAssessmentSchema, postStudentAssessmentSchema} = require('../validations/eas'); const PERMISSION = perm.PERMISSION; @@ -16,7 +16,7 @@ router.get('/assessment-sessions', passport.authenticate('jwt', {session: false} router.get('/assessment-sessions/school-year/:schoolYear', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.MANAGE_EAS_SESSIONS_PERMISSION), extendSession, getAssessmentSessionsBySchoolYear); router.put('/assessment-sessions/:sessionID', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.MANAGE_EAS_SESSIONS_PERMISSION), extendSession, updateAssessmentSession); -router.post('/assessment-registrations/student', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.EDIT_EAS_STUDENT_PERMISSION), extendSession, postAssessmentStudent); +router.post('/assessment-registrations/student', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.EDIT_EAS_STUDENT_PERMISSION), extendSession, validate(postStudentAssessmentSchema), postAssessmentStudent); router.get('/assessment-registrations/student/:assessmentStudentID', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.VIEW_EAS_STUDENT_PERMISSION), extendSession, getAssessmentStudentByID); router.put('/assessment-registrations/student/:assessmentStudentID', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.EDIT_EAS_STUDENT_PERMISSION), extendSession, validate(putStudentAssessmentSchema), updateAssessmentStudentByID); router.get('/assessment-registrations/paginated', passport.authenticate('jwt', {session: false}, undefined), permUtils.checkUserHasPermission(PERMISSION.VIEW_EAS_STUDENT_PERMISSION), extendSession, getAssessmentStudentsPaginated); diff --git a/backend/src/validations/eas.js b/backend/src/validations/eas.js index 88f79cf8..47cada38 100644 --- a/backend/src/validations/eas.js +++ b/backend/src/validations/eas.js @@ -5,9 +5,9 @@ const putStudentAssessmentSchema = object({ body: object({ assessmentStudentID: string().nonNullable(), sessionID:string().nonNullable(), - districtID: string().nonNullable(), + districtID: string().nullable().optional(), schoolID: string().nonNullable(), - assessmentCenterID: string().nullable().optional(), + assessmentCenterID: string().nonNullable(), assessmentID:string().nonNullable(), assessmentTypeCode: string().nonNullable(), studentID: string().nonNullable(), @@ -15,7 +15,7 @@ const putStudentAssessmentSchema = object({ localID: string().max(12).nonNullable(), givenName: string().max(25).nonNullable(), surName: string().max(25).nonNullable(), - isElectronicExam: boolean().nonNullable(), + isElectronicExam: boolean().nullable().optional(), proficiencyScore: number().nullable().optional(), provincialSpecialCaseCode: string().max(1).nullable().optional(), courseStatusCode: string().max(1).nullable().optional(), @@ -27,7 +27,9 @@ const putStudentAssessmentSchema = object({ assessmentStudentID:string().nullable().optional(), validationIssueSeverityCode:string().nullable().optional(), validationIssueCode:string().nullable().optional(), - validationIssueFieldCode:string().nullable().optional() + validationIssueFieldCode:string().nullable().optional(), + validationLabel:string().nullable().optional(), + validationMessage:string().nullable().optional(), }).concat(baseRequestSchema)).nullable().optional() }).concat(baseRequestSchema).noUnknown(), params: object({ @@ -36,6 +38,41 @@ const putStudentAssessmentSchema = object({ query: object().noUnknown(), }).noUnknown(); +const postStudentAssessmentSchema = object({ + body: object({ + sessionID:string().nonNullable(), + districtID: string().nonNullable(), + schoolID: string().nonNullable(), + assessmentCenterID: string().nonNullable(), + assessmentID:string().nonNullable(), + assessmentTypeCode: string().nonNullable(), + studentID: string().nullable().optional(), + assessmentStudentID: string().nullable().optional(), + courseStatusCode: string().nullable().optional(), + numberOfAttempts: string().nullable().optional(), + pen: string().max(9).nonNullable(), + localID: string().max(12).nonNullable(), + givenName: string().max(25).nonNullable(), + surName: string().max(25).nonNullable(), + isElectronicExam: boolean().nullable().optional(), + proficiencyScore: number().nullable().optional(), + provincialSpecialCaseCode: string().max(1).nullable().optional(), + assessmentStudentValidationIssues: array().of(object({ + assessmentStudentID:string().nullable().optional(), + validationIssueSeverityCode:string().nullable().optional(), + validationIssueCode:string().nullable().optional(), + validationIssueFieldCode: string().nullable().optional(), + validationLabel:string().nullable().optional(), + validationMessage:string().nullable().optional(), + }).concat(baseRequestSchema)).nullable().optional() + }).concat(baseRequestSchema).noUnknown(), + query: object().noUnknown(), + params: object({ + instituteType: string().nonNullable(), + }).noUnknown(), +}).noUnknown(); + module.exports = { putStudentAssessmentSchema, + postStudentAssessmentSchema }; diff --git a/frontend/src/components/assessments/registrations/StudentRegistrations.vue b/frontend/src/components/assessments/registrations/StudentRegistrations.vue index a04b9997..292e570d 100644 --- a/frontend/src/components/assessments/registrations/StudentRegistrations.vue +++ b/frontend/src/components/assessments/registrations/StudentRegistrations.vue @@ -172,7 +172,7 @@ export default { }, }, created() { - this.applydefaultFilers(); + this.applyDefaultFilters(); this.getAssessmentStudents(); }, methods: { @@ -194,7 +194,7 @@ export default { } this.reloadStudentRegistrationsFlag = false; }, - applydefaultFilers() { + applyDefaultFilters() { if (this.sessionID) { const activeSession = this.schoolYearSessions.find( (session) => session.sessionID === this.sessionID @@ -253,9 +253,6 @@ export default { openCreateStudentRegDialog() { this.newStudentRegistrationSheet = !this.newStudentRegistrationSheet; }, - closeNewStudentRegModal() { - this.newStudentRegistrationSheet = false; - }, loadNext() { if (this.canLoadNext) { this.pageNumber += 1; diff --git a/frontend/src/components/assessments/registrations/forms/AddStudentRegistration.vue b/frontend/src/components/assessments/registrations/forms/AddStudentRegistration.vue index 94c1fa0b..28f2d539 100644 --- a/frontend/src/components/assessments/registrations/forms/AddStudentRegistration.vue +++ b/frontend/src/components/assessments/registrations/forms/AddStudentRegistration.vue @@ -25,7 +25,7 @@