From 67b851fa543659286ff62d3e3df99e6e369ebcd1 Mon Sep 17 00:00:00 2001
From: Avisha Sodhi <38086281+SodhiA1@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:52:03 -0700
Subject: [PATCH 1/2] UI: Issue NEW PEN
---
backend/src/components/sdc/sdc.js | 12 +-
.../PenMatchStudentDetails.vue | 53 +--
.../data-collection/SDCIssueNewPEN.vue | 365 ++++++++++++++++++
frontend/src/utils/common.js | 18 +
4 files changed, 420 insertions(+), 28 deletions(-)
create mode 100644 frontend/src/components/data-collection/SDCIssueNewPEN.vue
diff --git a/backend/src/components/sdc/sdc.js b/backend/src/components/sdc/sdc.js
index 0b44f81bd..091f1bb6e 100644
--- a/backend/src/components/sdc/sdc.js
+++ b/backend/src/components/sdc/sdc.js
@@ -565,12 +565,20 @@ async function updateStudentPEN(req, res) {
payload.updateUser = utils.getUser(req).idir_username;
payload.enrolledProgramCodes = null;
payload.penMatchResult = null;
-
+ if (payload?.numberOfCourses) {
+ payload.numberOfCourses = stripNumberFormattingNumberOfCourses(payload.numberOfCourses);
+ }
const data = await postData(`${config.get('sdc:schoolCollectionStudentURL')}/update-pen/type/${req.params.penCode}`, payload);
return res.status(HttpStatus.OK).json(data);
} catch (e) {
logApiError(e, 'Error updating student PEN');
- return errorResponse(res);
+ if (e.status === 400 && e.data.message === 'SdcSchoolCollectionStudent was not saved to the database because it would create a provincial duplicate.') {
+ return res.status(HttpStatus.CONFLICT).json({
+ status: HttpStatus.CONFLICT,
+ message: 'Student was not saved because it would create provincial a duplicate.'
+ });
+ }
+ return handleExceptionResponse(e, res);
}
}
diff --git a/frontend/src/components/data-collection/PenMatchStudentDetails.vue b/frontend/src/components/data-collection/PenMatchStudentDetails.vue
index c836c4667..34830d504 100644
--- a/frontend/src/components/data-collection/PenMatchStudentDetails.vue
+++ b/frontend/src/components/data-collection/PenMatchStudentDetails.vue
@@ -81,7 +81,7 @@
:loading="isIssuingNewPen"
:disabled="studentDetails?.penMatchResult === 'NEW' || studentDetails?.penMatchResult === 'MATCH'"
text="Issue new PEN"
- @click-action="issueNewPen"
+ @click-action="togglePENRequestDialog"
/>
+
+
+
+
+
diff --git a/frontend/src/utils/common.js b/frontend/src/utils/common.js
index f628840d1..ff40d60ff 100644
--- a/frontend/src/utils/common.js
+++ b/frontend/src/utils/common.js
@@ -99,6 +99,24 @@ export function getDemogValidationResults(student) {
});
}
+export function constructPenMatchObjectFromSdcStudent(student) {
+ return {
+ pen: student.studentPen,
+ localID: student.localID,
+ surname: student.legalLastName,
+ givenName: student.legalFirstName,
+ middleName: student.legalMiddleNames,
+ usualSurname: student.usualLastName,
+ usualGiven: student.usualFirstName,
+ usualMiddleName: student.usualMiddleNames,
+ dob: student.dob,
+ sex: student.gender,
+ enrolledGradeCode: student.enrolledGradeCode,
+ postal: student.postalCode,
+ mincode: student.mincode
+ };
+}
+
/**
* this function will only return the below structure
String possibleMatchID;
From 0f86ccf0448176165147254c022ed9c46f73711f Mon Sep 17 00:00:00 2001
From: Avisha Sodhi <38086281+SodhiA1@users.noreply.github.com>
Date: Fri, 11 Oct 2024 15:54:23 -0700
Subject: [PATCH 2/2] Update SDCIssueNewPEN.vue
---
frontend/src/components/data-collection/SDCIssueNewPEN.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/src/components/data-collection/SDCIssueNewPEN.vue b/frontend/src/components/data-collection/SDCIssueNewPEN.vue
index f7a4d0860..e3d188fbc 100644
--- a/frontend/src/components/data-collection/SDCIssueNewPEN.vue
+++ b/frontend/src/components/data-collection/SDCIssueNewPEN.vue
@@ -238,7 +238,7 @@