Skip to content

Commit

Permalink
Merge branch 'master' into fix/move-sld
Browse files Browse the repository at this point in the history
  • Loading branch information
mightycox authored Sep 11, 2024
2 parents a8e1128 + 1de5402 commit b7bc8ee
Show file tree
Hide file tree
Showing 10 changed files with 339 additions and 31 deletions.
3 changes: 2 additions & 1 deletion backend/src/components/ministrySDCReports.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { logApiError, errorResponse, getData } = require('./utils');
const config = require('../config/index');
const HttpStatus = require('http-status-codes');
let reportTypes = ['indy-inclusive-ed-enrollment-headcounts', 'school-enrollment-headcounts', 'indy-school-enrollment-headcounts', 'school-address-report', 'fsa-registration-report',
'offshore-enrollment-headcounts', 'offshore-languages-headcounts'];
'offshore-enrollment-headcounts', 'offshore-languages-headcounts', 'indy-inclusive-ed-funding-headcounts', 'inclusive-education-variance-headcounts'];

async function getMinistrySDCReport(req, res) {
try {
Expand Down Expand Up @@ -49,6 +49,7 @@ function getFileDetails(reportType) {
'fsa-registration-report': { filename: 'FsaRegistrationReport.csv', contentType: 'text/csv' },
'offshore-enrollment-headcounts': { filename: 'OffshoreSchoolsHeadcounts.csv', contentType: 'text/csv' },
'offshore-languages-headcounts': { filename: 'OffshoreSpokenLanguageHeadcounts.csv', contentType: 'text/csv' },
'indy-inclusive-ed-funding-headcounts': { filename: 'IndependentSchoolsInclusiveEdFundingHeadcounts.csv', contentType: 'text/csv' },
'DEFAULT': { filename: 'download.pdf', contentType: 'application/pdf' }
};
return mappings[reportType] || mappings['DEFAULT'];
Expand Down
18 changes: 17 additions & 1 deletion backend/src/components/sdc/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function getIndySdcSchoolCollectionMonitoringByCollectionId(req, res) {
const data = await getData(`${config.get('sdc:collectionURL')}/${req.params.collectionID}/monitorIndySdcSchoolCollections`);
return res.status(HttpStatus.OK).json(data);
} catch (e) {
await logApiError(e, 'Error retrieving the district collection monitoring stats');
await logApiError(e, 'Error retrieving the indy school collection monitoring stats');
return errorResponse(res);
}
}
Expand Down Expand Up @@ -888,6 +888,7 @@ async function downloadSdcReport(req, res) {
}
}


async function moveSld (req, res) {
try {
await postData(`${config.get('sdc:schoolCollectionStudentURL')}/move-sld`, req.body);
Expand All @@ -896,6 +897,20 @@ async function moveSld (req, res) {
logApiError(e, 'Error attempting to move sld record(s)');
return errorResponse(res);
}

async function getDistrictHeadcounts(req, res) {
try {
const params = {
params: {
type: req.query.type,
}
};
let headCounts = await getData(`${config.get('sdc:rootURL')}/headcounts/${req.params.sdcDistrictCollectionID}`, params);
return res.status(HttpStatus.OK).json(headCounts);
} catch (e) {
await logApiError(e, 'getDistrictHeadcounts', 'Error getting District headcount.');
return errorResponse(res);
}
}

function getFileDetails(reportType) {
Expand Down Expand Up @@ -941,4 +956,5 @@ module.exports = {
downloadSdcReport,
updateBandCode,
moveSld
getDistrictHeadcounts
};
2 changes: 1 addition & 1 deletion backend/src/components/studentFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ function createNameCriteria(key, nameString) {
operation: FILTER_OPERATION.CONTAINS_IGNORE_CASE,
value: `%${name}%`,
valueType: VALUE_TYPE.STRING,
condition: CONDITION.OR
condition: CONDITION.AND
});
});
} else {
Expand Down
3 changes: 2 additions & 1 deletion backend/src/routes/sdc.js

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

71 changes: 50 additions & 21 deletions frontend/src/components/data-collection/DuplicatesPosting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
color="primary"
text="Post Province Duplicates"
class="ma-2"
:disabled="isPostProvincialDuplicatesButtonDisabled || isCloseCollectionButtonDisabled"
:disabled="isPostProvincialDuplicatesButtonDisabled"
@click="postProvincialDuplicates"
/>
<v-btn
Expand Down Expand Up @@ -122,7 +122,7 @@
color="primary"
text="Post and Close Collection"
class="ma-2"
:disabled="!validForm"
:disabled="!validForm || isCloseCollectionButtonDisabled"
@click="closeCollection"
/>
</v-row>
Expand Down Expand Up @@ -201,33 +201,22 @@ export default {
submissionDueDate: null,
duplicationResolutionDueDate: null,
signoffDueDate: null
}
},
monitorSdcDistrictCollectionsResponse: [],
monitorSdcSchoolCollectionsResponse: [],
isPostProvincialDuplicatesButtonDisabled: false,
isCloseCollectionButtonDisabled: false
};
},
computed: {
...mapState(sdcCollectionStore, ['districtCollectionStatusCodesMap']),
...mapState(sdcCollectionStore, ['schoolCollectionStatusCodesMap']),
...mapState(sdcCollectionStore, ['duplicateResolutionCodesMap']),
...mapState(sdcCollectionStore, ['collectionTypeCodesMap']),
isPostProvincialDuplicatesButtonDisabled() {
const allDistrictsSubmitted = Array.from(this.districtCollectionStatusCodesMap.values()).every(value => value.sdcDistrictCollectionStatusCode === 'SUBMITTED');
const allIndieSchoolsSubmitted = Array.from(this.schoolCollectionStatusCodesMap.values()).every(value => value.sdcSchoolCollectionStatusCode === 'SUBMITTED');
const allPenFixesResolved = this.totalPenFixElements === 0;
return !allDistrictsSubmitted || !allIndieSchoolsSubmitted || !allPenFixesResolved;
},
...mapState(sdcCollectionStore, ['duplicateResolutionCodesMap', 'collectionTypeCodesMap']),
isResolveRemainingDuplicatesButtonDisabled() {
return this.nonAllowableDuplicates?.length === 0 && this.nonAllowableProgramDuplicates?.length === 0;
},
isCloseCollectionButtonDisabled() {
const allDistrictsCompleted = Array.from(this.districtCollectionStatusCodesMap.values()).every(value => value.sdcDistrictCollectionStatusCode === 'COMPLETED');
const allIndieSchoolsCompleted = Array.from(this.schoolCollectionStatusCodesMap.values()).every(value => value.sdcSchoolCollectionStatusCode === 'COMPLETED');
return !allDistrictsCompleted || !allIndieSchoolsCompleted;
}
},
async created() {
await sdcCollectionStore().getDistrictCollectionStatusCodeMap();
await sdcCollectionStore().getSchoolCollectionStatusCodeMap();
await this.getSdcSchoolCollections();
await this.getSdcDistrictCollectionMonitoring();
await sdcCollectionStore().getDuplicateResolutionCodesMap();
sdcCollectionStore().getCodes().then(() => {
this.loadStudents();
Expand All @@ -236,8 +225,48 @@ export default {
sdcCollectionStore().getCollectionTypeCodesMap().finally(() => {
this.getActiveCollection();
});
this.checkIsPostProvincialDuplicatesButtonDisabled();
this.checkIsCloseCollectionButtonDisabled();
},
methods: {
async getSdcSchoolCollections(){
this.isLoading = true;
await ApiService.apiAxios.get(`${Routes.sdc.BASE_URL}/collection/${this.collectionObject.collectionID}/indySdcSchoolCollectionMonitoring`, {
}).then(response => {
this.monitorSdcSchoolCollectionsResponse = response?.data.monitorSdcSchoolCollections;
}).catch(error => {
console.error(error);
this.setFailureAlert(error?.response?.data?.message ? error?.response?.data?.message : 'An error occurred while trying to get indy school collections. Please try again later.');
}).finally(() => {
this.isLoading = false;
});
},
async getSdcDistrictCollectionMonitoring() {
this.isLoading = true;
await ApiService.apiAxios.get(`${Routes.sdc.BASE_URL}/collection/${this.collectionObject.collectionID}/sdcDistrictCollectionMonitoring`, {
}).then(response => {
this.monitorSdcDistrictCollectionsResponse = response?.data;
}).catch(error => {
console.error(error);
this.setFailureAlert(error?.response?.data?.message ? error?.response?.data?.message : 'An error occurred while trying to get sdc district collections. Please try again later.');
}).finally(() => {
this.isLoading = false;
});
},
checkIsPostProvincialDuplicatesButtonDisabled() {
const districtsNotSubmittedCount = this.monitorSdcDistrictCollectionsResponse.filter(response => response.sdcDistrictCollectionStatusCode !== 'SUBMITTED').length;
const indieSchoolsNotSubmittedCount = this.monitorSdcSchoolCollectionsResponse.filter(response => response.schoolStatus !== 'SUBMITTED').length;
const allPenFixesResolved = this.totalPenFixElements === 0;
this.isPostProvincialDuplicatesButtonDisabled = districtsNotSubmittedCount > 0 || indieSchoolsNotSubmittedCount > 0 || !allPenFixesResolved;
},
checkIsCloseCollectionButtonDisabled() {
const districtsNotCompletedCount = this.monitorSdcDistrictCollectionsResponse.filter(response => response.sdcDistrictCollectionStatusCode !== 'COMPLETED').length;
const indieSchoolsNotCompletedCount = this.monitorSdcSchoolCollectionsResponse.filter(response => response.schoolStatus !== 'COMPLETED').length;
this.isCloseCollectionButtonDisabled = districtsNotCompletedCount > 0 || indieSchoolsNotCompletedCount > 0;
},
getProvincialDuplicates(){
this.isLoading = true;
ApiService.apiAxios.get(Routes.sdc.BASE_URL + '/collection/'+ this.collectionID + '/provincial-duplicates').then(response => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<template>
<v-col>
<v-row>
<slot
name="text-search"
>
<v-autocomplete
id="selectDistrict"
v-model="districtsNameNumberFilter"
variant="outlined"
:items="districtNames"
color="#003366"
label="District Select"
single-line
:clearable="true"
item-title="codeName"
item-value="id"
autocomplete="off"
@update:model-value="setDistrictsNameNumberFilter('district', $event)"
/>
</slot>
</v-row>
</v-col>
<v-col v-if="loading">
<Spinner />
</v-col>
<v-col v-else-if="districtsNameNumberFilter != null && tableID != null">
<HeadCountReportComponent
:table-i-d="tableID"
:headcount-table-data="headcountTableData"
/>
<br>
<span>** This report displays the count of students reported by each district and eligible for Inclusive Education funding.</span>
</v-col>
</template>

<script>
import ApiService from '@/common/apiService';
import {Routes} from '@/utils/constants';
import {appStore} from '@/store/modules/app';
import {mapState} from 'pinia';
import {sortBy} from 'lodash';
import {FTE} from '@/utils/sdc/collectionTableConfiguration.js';
import HeadCountReportComponent from './common/HeadCountReportComponent.vue';
import Spinner from '@/components/common/Spinner.vue';
export default {
name: 'FundingPolicyReport',
components: {HeadCountReportComponent, Spinner},
props: {
collectionObject: {
type: Object,
required: true,
default: null
},
collectionType: {
type: String,
required: true,
}
},
data() {
return {
districtsNameNumberFilter: null,
districtNames: [],
config: FTE,
districtObject: null,
headcountTableData: null,
tableID: null,
loading: false
};
},
computed: {
...mapState(appStore, ['districtMap']),
},
created() {
appStore().getInstituteCodes().then(() => {
this.setupDistrictsList();
this.loading = false;
});
},
methods: {
setDistrictsNameNumberFilter(key, $event) {
if ($event) {
this.districtObject = { type: key, id: $event };
this.fetchDistrictSummaryCounts();
} else {
this.districtObject = null;
}
},
setupDistrictsList() {
this.districtNames = [];
ApiService.apiAxios.get(`${Routes.sdc.BASE_URL}/collection/${this.$route.params.collectionID}/sdcDistrictCollections`)
.then((res) => {
res.data.forEach(districtCollection => {
const district = this.districtMap.get(districtCollection.districtID);
if (district) {
let districtItem = {
codeName: district.name + ' - ' + district.districtNumber,
id: districtCollection.sdcDistrictCollectionID,
};
this.districtNames.push(districtItem);
}
});
this.districtNames = sortBy(this.districtNames, ['codeName']);
})
.catch(error => {
console.error(error);
});
},
fetchDistrictSummaryCounts() {
this.loading = true;
ApiService.apiAxios.get(`${Routes.sdc.SDC_SCHOOL_COLLECTION_STUDENT}/getDistrictHeadcounts/${this.districtObject.id}`, {
params: {
type: this.collectionType,
}
}).then(response => {
this.headcountTableData = response.data.headcountResultsTable;
this.tableID = '12345';
}).catch(error => {
console.error(error);
this.setFailureAlert('An error occurred while trying to retrieve students list. Please try again later.');
}).finally(() => {
this.loading = false;
});
},
}
};
</script>
11 changes: 9 additions & 2 deletions frontend/src/components/data-collection/ReportSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
:collection-type="selectedReport?.reportID"
/>
</v-col>
<v-col v-if="selectedReport?.reportID === 'INCLUSIVE_EDUCATION_VARIANCE'">
<InclusiveEducationVarianceReport
:collection-object="collectionObject"
:collection-type="selectedReport?.reportID"
/>
</v-col>
</v-row>
</template>
Expand All @@ -102,10 +108,11 @@ import CustomTableSlice from '@/components/common/CustomTableSlice.vue';
import {Routes} from '@/utils/constants';
import {isEmpty, omitBy} from 'lodash';
import FundingPolicyReport from './FundingPolicyReports.vue';
import InclusiveEducationVarianceReport from './InclusiveEducationVarianceReport.vue';
export default {
name: 'ReportSection',
components: {FundingPolicyReport, Spinner, CustomTableSlice},
components: {FundingPolicyReport, InclusiveEducationVarianceReport, Spinner, CustomTableSlice},
mixins: [alertMixin],
props: {
reportList: {
Expand Down Expand Up @@ -151,7 +158,7 @@ export default {
if(this.displayAllStudents) {
this.loadStudents();
}
} else if (this.selectedReport.reportID === 'FUNDING_POLICY_REPORT_INDY' || this.selectedReport.reportID === 'FUNDING_POLICY_REPORT_DISTRICT') {
} else if (this.selectedReport.reportID === 'FUNDING_POLICY_REPORT_INDY' || this.selectedReport.reportID === 'FUNDING_POLICY_REPORT_DISTRICT' || this.selectedReport.reportID === 'INCLUSIVE_EDUCATION_VARIANCE') {
this.displayAllStudents = false;
this.reportData = null;
} else {
Expand Down
17 changes: 14 additions & 3 deletions frontend/src/components/data-collection/Reports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,29 @@ export default {
data() {
return {
reportView: null,
publicReports: SDC_REPORTS.publicReports,
independentReports: SDC_REPORTS.independentReports,
headcountsReports: SDC_REPORTS.headcountReports
publicReports: [],
independentReports: [],
headcountsReports: []
};
},
computed: {
...mapState(authStore, ['userInfo'])
},
created() {
this.setOriginalReportTab();
this.publicReports = this.getActiveReports(SDC_REPORTS.publicReports);
this.independentReports = this.getActiveReports(SDC_REPORTS.independentReports);
this.headcountsReports = this.getActiveReports(SDC_REPORTS.headcountReports);
},
methods: {
getActiveReports(reports){
return reports.filter(report => {
if(report.onlyForCollection && !report.onlyForCollection.includes(this.collectionObject.collectionTypeCode)){
return false;
}
return true;
});
},
setOriginalReportTab(){
if(this.hasAccessToPublicReports()){
this.reportView = 'publicReports';
Expand Down
Loading

0 comments on commit b7bc8ee

Please sign in to comment.