From d7781fb1aff4171209d6d1bd40f32fc9efc3aeff Mon Sep 17 00:00:00 2001
From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com>
Date: Thu, 21 Sep 2023 15:37:30 -0700
Subject: [PATCH] EDX-1256: Verify Special Education Categories for Reported
 Students

---
 backend/src/components/sdc.js                               | 4 +++-
 .../sdcCollection/stepThreeVerifyData/DetailComponent.vue   | 4 +++-
 frontend/src/utils/sdc/TableConfiguration.js                | 6 +++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/backend/src/components/sdc.js b/backend/src/components/sdc.js
index f02c0fc88..8d6b79851 100644
--- a/backend/src/components/sdc.js
+++ b/backend/src/components/sdc.js
@@ -289,6 +289,9 @@ function createSearchCriteria(searchParams = []) {
       if (['FRENCH_PR', 'CAREER_PR', 'INDSUPPORT_PR'].includes(searchParams[key].label)) {
         searchCriteriaList.push({ key: tableKey, operation: FILTER_OPERATION.IN, value: searchParams[key].enrolledProgramCodeValues, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND });
       }
+      if(searchParams[key].label === 'SPECIALED_PR') {
+        searchCriteriaList.push({ key: 'specialEducationCategoryCode', operation: FILTER_OPERATION.IN, value: searchParams[key].spedCodeValues, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND });
+      }
     }
     if (key === 'studentPen') {
       searchCriteriaList.push({ key: key, operation: FILTER_OPERATION.CONTAINS_IGNORE_CASE, value: pValue, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND});
@@ -297,7 +300,6 @@ function createSearchCriteria(searchParams = []) {
       searchCriteriaList.push({key: key, operation: FILTER_OPERATION.IN, value: pValue, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND});
     }
   });
-
   return searchCriteriaList;
 }
 
diff --git a/frontend/src/components/sdcCollection/stepThreeVerifyData/DetailComponent.vue b/frontend/src/components/sdcCollection/stepThreeVerifyData/DetailComponent.vue
index abb645ad2..11776b85e 100644
--- a/frontend/src/components/sdcCollection/stepThreeVerifyData/DetailComponent.vue
+++ b/frontend/src/components/sdcCollection/stepThreeVerifyData/DetailComponent.vue
@@ -175,7 +175,7 @@ export default {
     };
   },
   computed: {
-    ...mapState(useSdcCollectionStore, ['schoolFundingCodesMap', 'enrolledProgramCodesMap', 'careerProgramCodesMap', 'bandCodesMap']),
+    ...mapState(useSdcCollectionStore, ['schoolFundingCodesMap', 'enrolledProgramCodesMap', 'careerProgramCodesMap', 'bandCodesMap', 'specialEducationCodesMap']),
   },
   created() {
     useSdcCollectionStore().getCodes().then(() => {
@@ -222,6 +222,7 @@ export default {
       return mappedEnrolledPrograms;
     },
     mapStudentData(student) {
+      student.mappedSpedCode  = this.specialEducationCodesMap.get(student.specialEducationCategoryCode) !== undefined ? this.specialEducationCodesMap.get(student.specialEducationCategoryCode)?.specialEducationCategoryCode + '-' +  capitalize(this.specialEducationCodesMap.get(student.specialEducationCategoryCode)?.description) : null;
       student.mappedAncestryIndicator = student.nativeAncestryInd === null ? null : this.nativeAncestryInd(student);
       student.mappedFrenchEnrolledProgram = this.enrolledProgramMapping(student, enrolledProgram.FRENCH_ENROLLED_PROGRAM_CODES);
       student.careerProgram = this.enrolledProgramMapping(student, enrolledProgram.CAREER_ENROLLED_PROGRAM_CODES);
@@ -232,6 +233,7 @@ export default {
       student.indProgramEligible = student.indigenousSupportProgramNonEligReasonCode !== null ? 'No' : 'Yes';
       student.frenchProgramEligible = student.frenchProgramNonEligReasonCode !== null ? 'No' : 'Yes';
       student.careerProgramEligible = student.careerProgramNonEligReasonCode !== null ? 'No' : 'Yes';
+      student.spedProgramEligible = student.specialEducationNonEligReasonCode !== null ? 'No' : 'Yes';
       let noOfCourses = student.numberOfCourses;
       if(noOfCourses && noOfCourses.length === 4) {
         student.mappedNoOfCourses = (Number.parseInt(noOfCourses) / 100).toFixed(2);
diff --git a/frontend/src/utils/sdc/TableConfiguration.js b/frontend/src/utils/sdc/TableConfiguration.js
index 646bf9971..5dce652a9 100644
--- a/frontend/src/utils/sdc/TableConfiguration.js
+++ b/frontend/src/utils/sdc/TableConfiguration.js
@@ -63,15 +63,15 @@ export const INDSUPPORT_PR = Object.freeze(
 
 export const SPECIALED_PR = Object.freeze(
   {
-    defaultFilter: {label: 'SPECIALED_PR', description: 'Has Special Education Category'},
+    defaultFilter: {label: 'SPECIALED_PR', description: 'Has Special Education Category', spedCodeValues: 'A,B,C,D,E,F,G,H,K,P,Q,R'},
     tableHeaders: [
       { title: 'select', key: 'select' },
-      { title: 'FTE', key: 'fte', align:'start', subHeader: {title: 'Program Eligible', key: 'programEligible'} },
+      { title: 'FTE', key: 'fte', align:'start', subHeader: {title: 'Program Eligible', key: 'spedProgramEligible'} },
       { title: 'PEN', key: 'studentPen', subHeader: {title: 'Local ID', key: 'localID'}},
       { title: 'Legal Surname, Given (Middle)', key: 'legalName', subHeader: {title: 'Usual Surname, Given (Middle)', key: 'usualName'}},
       { title: 'Adult', key: 'isAdult', subHeader: {title: 'Grad', key: 'isGraduated'}},
       { title: 'Grade', key: 'enrolledGradeCode', subHeader: {title: 'Funding Code', key: 'mappedSchoolFunding'}},
-      { title: 'Special Education Category', key: 'specialEducationCategoryCode'},
+      { title: 'Special Education Category', key: 'mappedSpedCode'},
     ],
   }  
 );