Skip to content

Commit

Permalink
Merge pull request #2180 from bcgov/fix/sldHistory
Browse files Browse the repository at this point in the history
Sld History fix
  • Loading branch information
arcshiftsolutions authored Jan 21, 2025
2 parents 61a98d0 + 9e57cb5 commit 2025f5f
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 11 deletions.
57 changes: 56 additions & 1 deletion backend/src/components/sdc/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,60 @@ async function getSDCSchoolCollectionStudentPaginated(req, res) {
}
}

async function getSDCSchoolCollectionStudentSldHistoryPaginated(req, res) {
try {
const search = [];
if(req.query.searchParams) {
search.push({
condition: CONDITION.AND,
searchCriteriaList: createSearchCriteria(req.query.searchParams)
});
}

if(req.query.assignedStudentID) {
search.push({
condition: null,
searchCriteriaList: [{ key: 'assignedStudentId', value: req.query.assignedStudentID.join(','), operation: FILTER_OPERATION.IN_NOT_DISTINCT, valueType: VALUE_TYPE.UUID }]
});
}

const params = {
params: {
pageNumber: req.query.pageNumber,
pageSize: req.query.pageSize,
sort: JSON.stringify(req.query.sort),
searchCriteriaList: JSON.stringify(search),
}
};

let data = await getData(`${config.get('sdc:schoolCollectionStudentURL')}/paginated-sld-history`, params);
if (req?.query?.returnKey) {
let result = data?.content.map((student) => student[req?.query?.returnKey]);
return res.status(HttpStatus.OK).json(result);
}

if(req?.query?.tableFormat){
data.content = data?.content.map(toTableRow);
}

data?.content.forEach(value => {
let school = cacheService.getSchoolBySchoolID(value.schoolID);
value.schoolName = getSchoolName(school);
value.districtName = getDistrictName(cacheService.getDistrictJSONByDistrictId(school.districtID));
value.districtID = school.districtID;
});

return res.status(HttpStatus.OK).json(data);
} catch (e) {
if (e?.status === 404) {
res.status(HttpStatus.OK).json(null);
} else {
await logApiError(e, 'Error getting sdc school collection student paginated list');
return errorResponse(res);
}
}
}

async function getSDCSchoolCollectionStudentPaginatedSlice(req, res) {
try {
const search = [];
Expand Down Expand Up @@ -953,5 +1007,6 @@ module.exports = {
updateBandCode,
moveSld,
getDistrictHeadcounts,
getSdcSchoolCollectionsFromSdcDistrictCollectionID
getSdcSchoolCollectionsFromSdcDistrictCollectionID,
getSDCSchoolCollectionStudentSldHistoryPaginated
};
5 changes: 3 additions & 2 deletions backend/src/routes/sdc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions frontend/src/components/common/CompareDemographicsCommonV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
/>
</div>
<div
v-else-if="header.value === 'updateDate'"
v-else-if="header.value === 'snapshotDate'"
:class="existSldUsualName(item.item.raw)? 'flex-column-div' : 'flex-row-div'"
>
<span class="top-field-item">{{ formatDateFromDateTime(item.item.raw[header.value]) }}</span>
Expand Down Expand Up @@ -399,7 +399,7 @@ import staleStudentRecordMixin from '@/mixins/staleStudentRecordMixin';
import {notificationsStore} from '@/store/modules/notifications';
import {studentStore} from '@/store/modules/student';
import _ from 'lodash';
import {DateTimeFormatter, LocalDateTime} from '@js-joda/core';
import {DateTimeFormatter, LocalDate} from '@js-joda/core';
export default {
name: 'CompareDemographicsCommonV2',
Expand Down Expand Up @@ -440,7 +440,7 @@ export default {
],
headers: [
{ id: 'table-checkbox', type: 'select', key: 'checkbox', sortable: false },
{text: 'Date', value: 'updateDate', key: 'date', sortable: false, tooltip: 'Activity Date'},
{text: 'Date', value: 'snapshotDate', key: 'snapshotDate', sortable: false, tooltip: 'Activity Date'},
{text: 'Mincode', value: 'mincode', key: 'mincode', sortable: false, tooltip: 'Mincode'},
{text: 'Surname', value: 'legalLastName', key: 'surname', sortable: false, tooltip: 'Legal Surname'},
{text: 'Given', value: 'legalFirstName', key: 'givenName', sortable: false, tooltip: 'Legal Given Name'},
Expand Down Expand Up @@ -616,7 +616,7 @@ export default {
}
},
formatDateFromDateTime(inputDate) {
const date = LocalDateTime.parse(inputDate);
const date = LocalDate.parse(inputDate);
return date.format(DateTimeFormatter.ofPattern('yyyy/MM/dd'));
},
formatDob,
Expand All @@ -641,7 +641,7 @@ export default {
pageNumber: 0,
pageSize: this.pageSize,
sort: {
'sdcSchoolCollection.uploadDate': 'DESC'
'sdcSchoolCollection.collectionEntity.snapshotDate': 'DESC'
},
assignedStudentID: [...this.existingMergedStudentIdsMap.get(student?.studentID), student?.studentID],
tableFormat: true
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/common/CustomTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
<div v-else-if="column.key === 'updateDate'">
<span>{{ formatDateFromDateTime(props.item.raw[column.key]) }}</span>
</div>
<div v-else-if="column.key === 'snapshotDate'">
<span>{{ formatSnapshotDate(props.item.raw[column.key]) }}</span>
</div>
<span v-else-if="column.key === 'resolution'">
<slot
:sdc-school-collection-student="props.item.raw"
Expand Down Expand Up @@ -238,7 +241,7 @@ import {appStore} from '@/store/modules/app';
import {mapState} from 'pinia';
import {authStore} from '@/store/modules/auth';
import {sanitizeUrl} from '@braintree/sanitize-url';
import {DateTimeFormatter, LocalDateTime} from '@js-joda/core';
import {DateTimeFormatter, LocalDateTime, LocalDate} from '@js-joda/core';
export default {
name: 'CustomTable',
Expand Down Expand Up @@ -385,6 +388,10 @@ export default {
const date = LocalDateTime.parse(inputDate);
return date.format(DateTimeFormatter.ofPattern('yyyy/MM/dd'));
},
formatSnapshotDate(inputDate) {
const date = LocalDate.parse(inputDate);
return date.format(DateTimeFormatter.ofPattern('yyyy/MM/dd'));
},
getSdcStudentStatusIconColor(status) {
if (status === 'FUNDWARN') {
return '#ff9800';
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/components/penreg/student/StudentSLDHistoryV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
:highlight-changes="true"
:show-links="false"
:clickable="false"
@reload="reload"
>
<template #toolTip="{ toolTipText, chipText }">
<v-tooltip>
Expand Down Expand Up @@ -81,7 +82,7 @@ export default {
data() {
return {
tableHeaders: [
{title: 'Date', value: 'updateDate', key: 'updateDate', sortable: false, tooltip: 'Activity Date'},
{title: 'Date', value: 'snapshotDate', key: 'snapshotDate', sortable: false, tooltip: 'Activity Date'},
{ title: 'District', key: 'districtName' },
{ title: 'School', key: 'schoolName' },
{ title: 'Assigned PEN', key: 'assignedPen', subHeader: { title: 'Local ID', key: 'localID' } },
Expand Down Expand Up @@ -140,6 +141,14 @@ export default {
getStudentName(student) {
return `${student.legalLastName ? student.legalLastName + ',' : ''} ${student.legalFirstName ? student.legalFirstName : ''} ${student.legalMiddleNames ? student.legalMiddleNames : ''}`;
},
reload(value) {
if(value?.pageSize) {
this.pageSize = value?.pageSize;
} else if(value?.pageNumber) {
this.pageNumber = value?.pageNumber;
}
this.retrieveStudentSLDData();
},
retrieveStudentSLDData() {
this.loading = true;
ApiService.apiAxios
Expand All @@ -157,7 +166,7 @@ export default {
pageNumber: this.pageNumber - 1,
pageSize: this.pageSize,
sort: {
'sdcSchoolCollection.uploadDate': 'DESC'
'sdcSchoolCollection.collectionEntity.snapshotDate': 'DESC'
},
assignedStudentID: [...this.existingMergedStudentIds, this.student.studentID],
tableFormat: true
Expand Down

0 comments on commit 2025f5f

Please sign in to comment.