From a21f89108ef556168226c897787998da9a94eb80 Mon Sep 17 00:00:00 2001 From: Avisha Sodhi <38086281+SodhiA1@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:21:20 -0800 Subject: [PATCH] EDX-2174: Bug - "School Funding Type" is not working --- backend/src/components/studentFilters.js | 41 +++++++++++++------- frontend/src/utils/sdc/TableConfiguration.js | 2 +- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/backend/src/components/studentFilters.js b/backend/src/components/studentFilters.js index f092f3e36..446dfaee8 100644 --- a/backend/src/components/studentFilters.js +++ b/backend/src/components/studentFilters.js @@ -21,6 +21,7 @@ function createMoreFiltersSearchCriteria(searchFilter = []) { let spedFundingList = []; let ellList = []; let ellFunding = []; + let fundingTypeList = []; searchFilter.forEach((elem) => { let pValue = elem.value ? elem.value.map(filter => filter.value) : null; if (elem.key === 'studentType' && pValue) { @@ -81,20 +82,7 @@ function createMoreFiltersSearchCriteria(searchFilter = []) { searchCriteriaList.push({ key: 'fteZeroReasonCode', value: pValue.toString(), operation: FILTER_OPERATION.IN, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND }); } if (elem.key === 'fundingType' && pValue) { - validateFundingTypeFilter(pValue); - - if (pValue.includes('14')) { - searchCriteriaList.push({ key: 'schoolFundingCode', value: '14', operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); - } - if (pValue.includes('20')) { - searchCriteriaList.push({ key: 'schoolFundingCode', value: '20', operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); - } - if (pValue.includes('16')) { - searchCriteriaList.push({ key: 'schoolFundingCode', value: '16', operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); - } - if (pValue.includes('No Funding')) { - searchCriteriaList.push({ key: 'schoolFundingCode', value: null, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); - } + fundingTypeList = createFundingTypeFilter(pValue); } if (elem.key === 'bandResidence' && pValue) { bandCodeList.push({ key: 'bandCode', value: pValue.toString(), operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); @@ -114,6 +102,12 @@ function createMoreFiltersSearchCriteria(searchFilter = []) { searchCriteriaList: searchCriteriaList }); } + if (fundingTypeList.length > 0) { + search.push({ + condition: CONDITION.AND, + searchCriteriaList: fundingTypeList + }); + } if (studentTypeFilterList.length > 0) { search.push({ condition: CONDITION.AND, @@ -294,6 +288,25 @@ function createMoreFiltersSearchCriteria(searchFilter = []) { } } + function createFundingTypeFilter(pValue) { + let fundingTypeList = [] + validateFundingTypeFilter(pValue); + + if (pValue.includes('14')) { + fundingTypeList.push({ key: 'schoolFundingCode', value: '14', operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); + } + if (pValue.includes('20')) { + fundingTypeList.push({ key: 'schoolFundingCode', value: '20', operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); + } + if (pValue.includes('16')) { + fundingTypeList.push({ key: 'schoolFundingCode', value: '16', operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); + } + if (pValue.includes('No Funding')) { + fundingTypeList.push({ key: 'schoolFundingCode', value: null, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR }); + } + return fundingTypeList; + } + function createEllYearsFilter(pValue) { let ellList = [] if(pValue.includes('ell1Between5')) { diff --git a/frontend/src/utils/sdc/TableConfiguration.js b/frontend/src/utils/sdc/TableConfiguration.js index bd1e403e0..9d2c3a50a 100644 --- a/frontend/src/utils/sdc/TableConfiguration.js +++ b/frontend/src/utils/sdc/TableConfiguration.js @@ -90,7 +90,7 @@ export const FUNDING_TYPE_FILTER = Object.freeze( }, { title: '16 - Newcomer Refugee', - cvalue: '16' + value: '16' }, { title: 'No Funding Code',