From b83799ce469b3baf18b28ccfd9755f3bf25f1ded Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:40:25 -0700 Subject: [PATCH 1/2] SCH - See Headcount for Enrolment --- backend/src/components/sdc.js | 26 ++- backend/src/routes/sdc.js | 4 +- .../src/components/common/CustomTable.vue | 34 +-- .../sdcCollection/SDCCollectionSummary.vue | 7 +- .../stepThreeVerifyData/FTEComponent.vue | 7 +- .../StepThreeVerifyData.vue | 2 +- .../stepThreeVerifyData/SummaryComponent.vue | 204 ++++++++++++++++++ 7 files changed, 263 insertions(+), 21 deletions(-) create mode 100644 frontend/src/components/sdcCollection/stepThreeVerifyData/SummaryComponent.vue diff --git a/backend/src/components/sdc.js b/backend/src/components/sdc.js index c55c29ee2..dd2f9a3c1 100644 --- a/backend/src/components/sdc.js +++ b/backend/src/components/sdc.js @@ -229,6 +229,29 @@ async function deleteSDCSchoolCollectionStudent (req, res) { } } +async function getStudentHeadcounts(req, res) { + try { + const token = getAccessToken(req); + validateAccessToken(token); + checkEDXCollectionPermission(req); + await validateEdxUserAccess(token, req, res, req.params.sdcSchoolCollectionID); + console.log(req); + + const params = { + params: { + type: req.query.type, + compare: req.query.compare + } + }; + + let headCounts = await getDataWithParams(token,`${config.get('sdc:schoolCollectionStudentURL')}/headcounts/${req.params.sdcSchoolCollectionID}`, params ,req.session?.correlationID); + return res.status(HttpStatus.OK).json(headCounts); + }catch (e) { + log.error('Error deleting SDC School Collection Student.', e.stack); + return handleExceptionResponse(e, res); + } +} + async function validateEdxUserAccess(token, req, res, sdcSchoolCollectionID){ const urlGetCollection = `${config.get('sdc:rootURL')}/sdcSchoolCollection/${sdcSchoolCollectionID}`; const sdcSchoolCollection = await getData(token, urlGetCollection, null); @@ -292,5 +315,6 @@ module.exports = { getSDCSchoolCollectionStudentSummaryCounts, getSDCSchoolCollectionStudentDetail, updateAndValidateSdcSchoolCollectionStudent, - deleteSDCSchoolCollectionStudent + deleteSDCSchoolCollectionStudent, + getStudentHeadcounts }; diff --git a/backend/src/routes/sdc.js b/backend/src/routes/sdc.js index 7f8e35396..c488a9bce 100644 --- a/backend/src/routes/sdc.js +++ b/backend/src/routes/sdc.js @@ -2,7 +2,7 @@ const passport = require('passport'); const express = require('express'); const router = express.Router(); const { getCollectionBySchoolId, uploadFile, getSdcFileProgress, updateSchoolCollection, getSchoolCollectionById, getSDCSchoolCollectionStudentPaginated, getSDCSchoolCollectionStudentSummaryCounts, getSDCSchoolCollectionStudentDetail, - updateAndValidateSdcSchoolCollectionStudent, deleteSDCSchoolCollectionStudent} = require('../components/sdc'); + updateAndValidateSdcSchoolCollectionStudent, deleteSDCSchoolCollectionStudent, getStudentHeadcounts} = require('../components/sdc'); const {getCachedSDCData} = require('../components/sdc-cache'); const auth = require('../components/auth'); const constants = require('../util/constants'); @@ -32,5 +32,7 @@ router.get('/sdcSchoolCollectionStudent/:sdcSchoolCollectionStudentID', passport router.put('/sdcSchoolCollectionStudent/:sdcSchoolCollectionID/student/:sdcSchoolCollectionStudentID', passport.authenticate('jwt', {session: false}, undefined), isValidBackendToken, updateAndValidateSdcSchoolCollectionStudent); router.delete('/sdcSchoolCollectionStudent/:sdcSchoolCollectionID/student/:sdcSchoolCollectionStudentID', passport.authenticate('jwt', {session: false}, undefined), isValidBackendToken, deleteSDCSchoolCollectionStudent); +router.get('/sdcSchoolCollectionStudent/getStudentHeadcounts/:sdcSchoolCollectionID', passport.authenticate('jwt', {session: false}, undefined), isValidBackendToken, getStudentHeadcounts); + module.exports = router; diff --git a/frontend/src/components/common/CustomTable.vue b/frontend/src/components/common/CustomTable.vue index c715c35c5..339d2e985 100644 --- a/frontend/src/components/common/CustomTable.vue +++ b/frontend/src/components/common/CustomTable.vue @@ -66,27 +66,31 @@