Skip to content

Commit

Permalink
Merge pull request #907 from bcgov/fix/nullEnrolledCodes
Browse files Browse the repository at this point in the history
Fix: Null enrolled codes on Step 4
  • Loading branch information
angadhsingh1 authored Jul 20, 2023
2 parents 98050dd + da0cd1e commit 051efbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions backend/src/components/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ async function getSDCSchoolCollectionStudentDetail (req, res) {

await validateEdxUserAccess(token, req, res, sdcSchoolCollectionStudentData.sdcSchoolCollectionID);

sdcSchoolCollectionStudentData.enrolledProgramCodes = sdcSchoolCollectionStudentData?.enrolledProgramCodes.match(/.{1,2}/g);

if(sdcSchoolCollectionStudentData?.enrolledProgramCodes) {
sdcSchoolCollectionStudentData.enrolledProgramCodes = sdcSchoolCollectionStudentData?.enrolledProgramCodes.match(/.{1,2}/g);
}

return res.status(HttpStatus.OK).json(sdcSchoolCollectionStudentData);
}catch (e) {
if(e?.status === 404){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,6 @@ const getSdcSchoolCollectionStudentDetail = (sdcSchoolCollectionStudentID) => {
ApiService.apiAxios.get(`${ApiRoutes.sdc.SDC_SCHOOL_COLLECTION_STUDENT}/${sdcSchoolCollectionStudentID}`)
.then(response => {
let filteredResponse = {...response.data, filteredEnrolledProgramCodes: filterEnrolledProgramCodes(response.data.enrolledProgramCodes), dob: formatDate(response.data.dob, from, pickerFormat)};
sdcSchoolCollectionStudentDetail.value = filteredResponse;
sdcSchoolCollectionStudentDetailCopy.value = cloneDeep(filteredResponse);
}).catch(error => {
Expand All @@ -855,7 +854,9 @@ const getSdcSchoolCollectionStudentDetail = (sdcSchoolCollectionStudentID) => {
};
const filterEnrolledProgramCodes = (enrolledProgramCodes = []) => {
return enrolledProgramCodes.filter(enrolledProgramCode => sdcCollectionStore.enrolledProgramCodesMap.has(enrolledProgramCode));
if(enrolledProgramCodes) {
return enrolledProgramCodes.filter(enrolledProgramCode => sdcCollectionStore.enrolledProgramCodesMap.has(enrolledProgramCode));
}
};
const syncWithEnrolledProgramCodeOnUserInput = (value) => {
Expand Down

0 comments on commit 051efbc

Please sign in to comment.