Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDX-2647: Ability to view deleted student records in open collection … #2019

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions backend/src/components/sdc/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,25 +212,28 @@ async function getSDCSchoolCollectionStudentPaginatedSlice(req, res) {
searchCriteriaList: [{ key: 'sdcSchoolCollection.collectionEntity.collectionID', value: req.params.collectionID, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.UUID }]
});

search.push({
condition: CONDITION.AND,
searchCriteriaList: createSearchCriteria(req.query.searchParams)
});

if(req.query.searchParams['tabFilter']) {
if(req?.query?.searchParams) {
search.push({
condition: CONDITION.AND,
searchCriteriaList: createSearchCriteria(req.query.searchParams)
});
}

if(req.query.searchParams?.['tabFilter']) {
search.push({
condition: CONDITION.AND,
searchCriteriaList: createTabFilter(req.query.searchParams['tabFilter'])
});
}

if (req.query.searchParams['moreFilters']) {
if (req.query.searchParams?.['moreFilters']) {
let criteriaArray = createMoreFiltersSearchCriteria(req.query.searchParams['moreFilters']);
criteriaArray.forEach(criteria => {
search.push(criteria);
});
}
if (req.query.searchParams['grade']) {

if (req?.query?.searchParams?.['grade']) {
search.push({
condition: CONDITION.AND,
searchCriteriaList: createFsaReportCriteria(req.query.searchParams['grade'])
Expand All @@ -245,7 +248,6 @@ async function getSDCSchoolCollectionStudentPaginatedSlice(req, res) {
searchCriteriaList: JSON.stringify(search),
}
};

let data = await getData(`${config.get('sdc:schoolCollectionStudentURL')}/paginated-slice`, params);
if (req?.query?.returnKey) {
let result = data?.content.map((student) => student[req?.query?.returnKey]);
Expand Down
14 changes: 8 additions & 6 deletions backend/src/components/studentFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function createMoreFiltersSearchCriteria(searchFilter = []) {
}
if (key === 'warnings' && pValue) {
validateWarningFilter(pValue);
searchCriteriaList.push({ key: 'sdcStudentValidationIssueEntities.validationIssueSeverityCode', value: pValue.toString(), operation: FILTER_OPERATION.IN, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND });
searchCriteriaList.push({ key: 'sdcSchoolCollectionStudentStatusCode', value: pValue.toString(), operation: FILTER_OPERATION.IN, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND });
}
if (key === 'grade' && pValue) {
validateGradeFilter(pValue);
Expand Down Expand Up @@ -343,7 +343,7 @@ function validateFteZeroFilter(filters) {
'AUTHDUP'
];
if (filters.length > 0) {
if (filters.every(value => fteZeroCategories.includes(cat => value === cat))) {
if (!filters.every(value => fteZeroCategories.includes(value))) {
log.error('Invalid zero fte reason code.');
throw new Error('400');
}
Expand All @@ -353,7 +353,7 @@ function validateFteZeroFilter(filters) {
function validateGradeFilter(filterGrades = []) {
const activeGradeCodes = cacheService.getActiveEnrolledGradeCodes();
if (filterGrades.length > 0) {
if (filterGrades.every(value => activeGradeCodes.includes(grade => value === grade.enrolledGradeCode))) {
if (!filterGrades.every(value => activeGradeCodes.includes(value))) {
log.error('Invalid grade filter.');
throw new Error('400');
}
Expand Down Expand Up @@ -392,11 +392,13 @@ function validateEnrolledProgramFilter(filterGrades = []) {

function validateWarningFilter(filters = []) {
let allowedWarningValues = [
'FUNDING_WARNING',
'INFO_WARNING'
'FUNDWARN',
'INFOWARN',
'ERROR',
'DELETED'
];
if (filters.length > 0) {
if (filters.every(value => allowedWarningValues.includes(cat => value === cat))) {
if (!filters.every(value => allowedWarningValues.includes(value))) {
log.error('Invalid warning filter.');
throw new Error('400');
}
Expand Down
37 changes: 37 additions & 0 deletions frontend/src/components/common/CustomTableSlice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<template #item="props">
<tr
class="hoverTable"
:style="{'color': getRow(props.item.raw['sdcSchoolCollectionStudentStatusCode'])}"
@click="rowClicked(props.item.raw)"
>
<td
Expand All @@ -72,6 +73,23 @@
hide-details="true"
@click.prevent.stop="onClick(props)"
/>
<v-tooltip
v-else-if="column.key === 'sdcSchoolCollectionStudentStatusCode'"
:style="{ display: getSdcStudentStatusHoverText(props.item.raw['sdcSchoolCollectionStudentStatusCode'], props.item.raw['sdcSchoolCollectionStudentValidationIssues']) ? '' : 'none'}"
>
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
size="25"
:color="getSdcStudentStatusIconColor(props.item.raw['sdcSchoolCollectionStudentStatusCode'])"
>
{{ getSdcStudentIssueIcon(props.item.raw['sdcSchoolCollectionStudentStatusCode']) }}
</v-icon>
</template>
<div style="white-space: pre-line;">
{{ getSdcStudentStatusHoverText(props.item.raw['sdcSchoolCollectionStudentStatusCode'], props.item.raw['sdcSchoolCollectionStudentValidationIssues']) }}
</div>
</v-tooltip>
<div v-else>
<span v-if="column.key === 'studentPen'">
{{ getAssignedPen(props.item.raw['assignedPen']) }}
Expand Down Expand Up @@ -306,20 +324,39 @@ export default {
return '#ff9800';
} else if (status === 'INFOWARN') {
return '#2196F3';
} else if (status === 'ERROR') {
return 'rgb(217, 6, 6)'
} else if (status === 'DELETED') {
return 'grey'
}
},
getSdcStudentIssueIcon(status) {
if (status === 'FUNDWARN') {
return 'mdi-alert-outline';
} else if (status === 'INFOWARN') {
return 'mdi-alert-circle-outline';
} else if (status === 'ERROR') {
return 'mdi-alert-circle-outline'
} else if (status === 'DELETED') {
return 'mdi-delete-circle-outline'
}
},
getSdcStudentStatusHoverText(status) {
if (status === 'FUNDWARN') {
return 'Funding Warning';
} else if (status === 'INFOWARN') {
return 'Info Warning';
} else if (status === 'ERROR') {
return 'Error';
} else if (status === 'DELETED') {
return 'Removed from collection'
}
},
getRow(status) {
if(status === 'DELETED') {
return 'grey'
} else {
return 'none'
}
},
getAssignedPen(assignedPen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
>
<ViewStudentDetailsComponent
:selected-student-ids="studentForEdit"
:readonly="['PROVDUPES', 'DUPES_RES', 'COMPLETED'].includes(collectionObject?.collectionStatusCode)"
:readonly="['PROVDUPES', 'DUPES_RES', 'COMPLETED'].includes(collectionObject?.collectionStatusCode) || isStudentRemoved"
@reload-students="reloadStudentsFlag = true"
@close="closeAndLoadStudents"
/>
Expand Down Expand Up @@ -164,14 +164,14 @@ export default {
selectedStudents: [],
filterSearchParams: {
tabFilter: this.config.defaultFilter,
notSdcSchoolCollectionStudentStatusCode: 'ERROR,DELETED',
moreFilters: {}
},
showFilters: null,
studentForEdit: [],
editStudentSheet: false,
resetFlag: false,
reloadStudentsFlag: false,
isStudentRemoved: false
};
},
computed: {
Expand Down Expand Up @@ -214,6 +214,7 @@ export default {
const selectedStudent = cloneDeep($event);
this.studentForEdit.splice(0);
this.studentForEdit.push(selectedStudent?.sdcSchoolCollectionStudentID);
this.isStudentRemoved = selectedStudent?.sdcSchoolCollectionStudentStatusCode === 'DELETED';
this.editStudentSheet = true;
},
applyFilters($event) {
Expand Down
19 changes: 15 additions & 4 deletions frontend/src/utils/sdc/collectionTableConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,30 @@

export const WARNING_FILTER = Object.freeze(
{
heading: 'Warnings',
heading: 'Student Status',
id: 'warnings',
multiple: true,
key: 'warnings',
filterOptions: [
{
title: 'Has Funding Warnings',
id: 'hasFundingWarning',
value: 'FUNDING_WARNING'
value: 'FUNDWARN'
},
{
title: 'Has Info Warnings',
id: 'hasInfoWarning',
value: 'INFO_WARNING'
value: 'INFOWARN'
},
{
title: 'Has Errors',
id: 'hasErrors',
value: 'ERROR'
},
{
title: 'Is removed from the collection',
id: 'isDeleted',
value: 'DELETED'
}
]
}
Expand Down Expand Up @@ -842,6 +852,7 @@ export const NEW_PEN = Object.freeze(
export const FTE = Object.freeze(
{
tableHeaders: [
{ key: 'sdcSchoolCollectionStudentStatusCode' },
{ title: 'District', key: 'districtName' },
{ title: 'School', key: 'schoolName' },
{ title: 'Assigned PEN', key: 'assignedPen', subHeader: { title: 'Local ID', key: 'localID' } },
Expand All @@ -860,11 +871,11 @@ export const FTE = Object.freeze(
{ title: 'Grade Enrolment & FTE per School', endpoint:'grade-enrollment'}
],
allowedFilters: {
warnings: WARNING_FILTER,
studentType: STUDENT_TYPE_FILTER,
fte: FTE_FILTER,
grade: GRADE_FILTER,
fundingType: FUNDING_TYPE_FILTER,
warnings: WARNING_FILTER,
courses: COURSE_FILTER,
support: SUPPORT_BLOCKS_FILTER,
fteZero: FTE_ZERO_FILTER,
Expand Down
Loading