Skip to content

Commit

Permalink
EDX-2174: Bug - "School Funding Type" is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
SodhiA1 committed Jan 25, 2024
1 parent 2acd13c commit a21f891
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
41 changes: 27 additions & 14 deletions backend/src/components/studentFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 });
Expand All @@ -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,
Expand Down Expand Up @@ -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')) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/sdc/TableConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const FUNDING_TYPE_FILTER = Object.freeze(
},
{
title: '16 - Newcomer Refugee',
cvalue: '16'
value: '16'
},
{
title: 'No Funding Code',
Expand Down

0 comments on commit a21f891

Please sign in to comment.