Skip to content

Commit

Permalink
Merge branch 'master' into feature/EAC-8
Browse files Browse the repository at this point in the history
# Conflicts:
#	tools/config/update-configmap.sh
  • Loading branch information
sumathi-thirumani committed Oct 12, 2024
2 parents fd4025d + af2e020 commit ba0514f
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 30 deletions.
4 changes: 2 additions & 2 deletions backend/src/components/eas/eas.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const { logApiError, getData, errorResponse } = require('../utils');
const { logApiError, getData, errorResponse, handleExceptionResponse } = require('../utils');
const HttpStatus = require('http-status-codes');
const utils = require('../utils');

Expand All @@ -12,7 +12,7 @@ async function getAssessmentSessions(req, res) {
return res.status(200).json(data);
} catch (e) {
logApiError(e, 'getAssessmentSessions', 'Error occurred while attempting to GET assessment sessions.');
return errorResponse(res);
return handleExceptionResponse(e, res);
}
}

Expand Down
17 changes: 16 additions & 1 deletion backend/src/components/sdc/sdc.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,20 @@ async function getSdcDistrictCollections(req, res) {
}
}

async function getSdcSchoolCollectionsFromSdcDistrictCollectionID(req, res) {
try {
const data = await getData(`${config.get('sdc:districtCollectionURL')}/${req.params.sdcDistrictCollectionID}/sdcSchoolCollections`);

data?.forEach(value => {
value.schoolName = getSchoolName(cacheService.getSchoolBySchoolID(value.schoolID));
});
return res.status(HttpStatus.OK).json(data);
} catch (e) {
await logApiError(e, 'getSdcSchoolCollectionBySdcDistrictCollectionId', 'error getSdcSchoolCollectionBySdcDistrictCollectionId');
return errorResponse(res);
}
}

async function downloadSdcReport(req, res) {
const reportTypeValues = [
['csv_school', 'ALL_STUDENT_SCHOOL_CSV'],
Expand Down Expand Up @@ -962,5 +976,6 @@ module.exports = {
downloadSdcReport,
updateBandCode,
moveSld,
getDistrictHeadcounts
getDistrictHeadcounts,
getSdcSchoolCollectionsFromSdcDistrictCollectionID
};
4 changes: 2 additions & 2 deletions backend/src/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ function formatNumberOfCourses(value) {
function handleExceptionResponse(e, res) {
if (e.message === '404' || e.status === '404' || e.status === 404) {
return res.status(HttpStatus.NOT_FOUND).json();
} else if(e.message === '403') {
} else if(e.message === '403' || e.status === 403) {
return res.status(HttpStatus.FORBIDDEN).json({
status: HttpStatus.FORBIDDEN,
message: 'You do not have permission to access this information'
});
} else if(e.message === '401'){
} else if(e.message === '401' || e.status === 401){
return res.status(HttpStatus.UNAUTHORIZED).json({
status: HttpStatus.UNAUTHORIZED,
message: 'Token is not valid'
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.

5 changes: 3 additions & 2 deletions frontend/src/components/assessments/AssessmentSessions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default {
},
data() {
return {
topN: 4,
search: null,
currentYear: LocalDate.now().year(),
itemsPerPage: 5,
Expand All @@ -114,7 +115,7 @@ export default {
activeSessions() {
const orderedSessions = [];
const allsessions = this.allsessions
.filter((session) => session.status === 'OPEN')
.filter((session, index) => index < this.topN)
.map((session) => {
return {
...session,
Expand All @@ -129,7 +130,7 @@ export default {
},
historicalSessions() {
return this.allsessions
.filter((session) => session.status !== 'OPEN')
.filter((session, index) => index >= this.topN)
.map((session) => {
return {
...session,
Expand Down
152 changes: 132 additions & 20 deletions frontend/src/components/common/Filters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,21 @@
<span>Name and ID Filtering</span>

<v-tooltip content-class="customTooltip">
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
size="25"
color="#003366"
style="align-self: center;"
>
mdi-help-circle
</v-icon>
</template>
<span id="penLocalIdNameFilterTooltip">
The search button must be used to apply changes to PEN or Local ID or Name searches. All other filters will apply on change without use of the search button.
</span>
</v-tooltip>
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
size="25"
color="#003366"
style="align-self: center;"
>
mdi-help-circle
</v-icon>
</template>
<span id="penLocalIdNameFilterTooltip">
The search button must be used to apply changes to PEN or Local ID or Name searches. All other filters will apply on change without use of the search button.
</span>
</v-tooltip>
</v-col>

</v-row>
<v-row>
<v-col
Expand Down Expand Up @@ -194,9 +193,11 @@
School and District Filtering
</v-col>
</v-row>
<v-row
>
<v-col cols="6" class="pt-0">
<v-row>
<v-col
cols="6"
class="pt-0"
>
<v-row v-if="false">
<v-text-field
id="searchInput"
Expand Down Expand Up @@ -225,7 +226,10 @@
/>
</slot>
</v-col>
<v-col cols="6" class="pt-0">
<v-col
cols="6"
class="pt-0"
>
<slot
name="text-search"
>
Expand All @@ -247,6 +251,41 @@
</v-col>
</v-row>
</div>
<div v-if="isDistrict === true">
<v-row>
<v-col
id="schoolFilters"
class="filter-heading pb-0"
>
School Filtering
</v-col>
</v-row>
<v-row>
<v-col
cols="6"
class="pt-0"
>
<slot
name="text-search"
>
<v-autocomplete
id="selectSchool"
v-model="schoolNameNumberFilterForDistrict"
variant="underlined"
:items="schoolSearchNamesForDistrict"
color="#003366"
label="School Name or Number"
single-line
:clearable="true"
item-title="schoolCodeName"
item-value="sdcSchoolCollectionID"
autocomplete="off"
@update:model-value="setSchoolNameNumberFilterForDistrict('schoolNameNumber', $event)"
/>
</slot>
</v-col>
</v-row>
</div>
<div
v-for="(filter, key) in filters"
:key="key"
Expand Down Expand Up @@ -282,6 +321,20 @@
</v-btn>
</div>
</v-btn-toggle>
<v-col v-if="key === 'bandCode'">
<v-autocomplete
id="bandCode"
v-model="bandCodeValue"
label="Band of Residence"
variant="underlined"
:items="sdcCollection.bandCodes"
item-value="bandCode"
item-title="dropdownText"
class="mt-n7 mb-n8"
clearable
@update:model-value="setBandCodeFilter('bandResidence', $event)"
/>
</v-col>
<v-col v-if="key === 'courses'">
<v-range-slider
id="courses-slider"
Expand Down Expand Up @@ -345,6 +398,7 @@ import {appStore} from '@/store/modules/app';
import {edxStore} from '@/store/modules/edx';
import {authStore} from '@/store/modules/auth';
import {mapState} from 'pinia';
import {sdcCollectionStore} from '@/store/modules/sdcCollection';
export default {
name: 'Filters',
Expand Down Expand Up @@ -378,6 +432,11 @@ export default {
required: false,
default: null
},
isDistrict: {
type: Boolean,
required: false,
default: false
},
},
emits: ['clearFilters', 'apply-filters', 'close'],
data() {
Expand All @@ -388,6 +447,7 @@ export default {
courseRange: [0, 15],
penLocalIdNameFilter: null,
schoolNameNumberFilter: null,
schoolNameNumberFilterForDistrict: null,
districtNameNumberFilter: null,
legalFirstName: null,
legalMiddleNames: null,
Expand All @@ -399,14 +459,26 @@ export default {
assignedPen: null,
localID: null,
schoolSearchNames: [],
schoolSearchNamesForDistrict: [],
districtSearchNames: [],
sdcCollection: sdcCollectionStore(),
};
},
computed: {
...mapState(appStore, ['districtMap', 'schoolMap', 'config']),
...mapState(edxStore, ['schoolRoles','schoolRolesCopy']),
...mapState(authStore, ['userInfo']),
},
watch: {
indySchoolDistrictObject: {
immediate: true,
handler(newVal) {
if (this.isDistrict && newVal) {
this.setupSchoolListForDistrict(newVal.id);
}
}
}
},
async beforeMount() {
if (this.schoolRoles.length === 0) {
await edxStore().getSchoolExchangeRoles();
Expand Down Expand Up @@ -449,6 +521,23 @@ export default {
console.error(error);
});
},
setupSchoolListForDistrict(sdcDistrictCollectionID){
this.schoolSearchNames = [];
ApiService.apiAxios.get(`${Routes.sdc.SDC_DISTRICT_COLLECTION}/${sdcDistrictCollectionID}/sdcSchoolCollections`)
.then((res) => {
res.data.forEach(schoolCollection => {
let schoolItem = {
schoolCodeName: schoolCollection.schoolName,
sdcSchoolCollectionID: schoolCollection.sdcSchoolCollectionID,
};
this.schoolSearchNames.push(schoolItem);
});
this.schoolSearchNamesForDistrict = sortBy(this.schoolSearchNames, ['schoolCodeName']);
})
.catch(error => {
console.error(error);
});
},
setupDistrictList(){
this.schoolSearchNames = [];
ApiService.apiAxios.get(`${Routes.sdc.BASE_URL}/collection/${this.$route.params.collectionID}/sdcDistrictCollections`)
Expand Down Expand Up @@ -503,6 +592,16 @@ export default {
this.apply();
}
},
setSchoolNameNumberFilterForDistrict(key, $event) {
this.setPenLocalIdNameFilter($event, null);
if($event) {
this.selected[key] = [{title: 'SchoolNameOrNumber', value: $event}];
this.apply();
} else {
delete this.selected[key];
this.apply();
}
},
setDistrictNameNumberFilter(key, $event) {
this.setPenLocalIdNameFilter($event, null);
if($event) {
Expand Down Expand Up @@ -561,7 +660,20 @@ export default {
},
apply() {
this.$emit('apply-filters', this.selected);
}
},
setBandCodeFilter(key, $event){
if (this.penLocalIdNameFilter != null) {
if (this.penLocalIdNameFilter.length > 0) this.selected['penLocalIdNameFilter'] = [{title: 'PenOrLocalIdOrName', value: this.penLocalIdNameFilter}];
else delete this.selected['penLocalIdNameFilter'];
}
if($event) {
this.selected[key] = [{title: this.sdcCollection.bandCodes.find(value => value.bandCode === $event).dropdownText, value: $event}];
this.apply();
} else {
delete this.selected[key];
this.apply();
}
},
}
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
:filters="config.allowedFilters"
:collection-object="collectionObject"
:indy-school-district-object="indySchoolDistrictObject"
:is-district="isDistrict"
@apply-filters="applyFilters"
@clear-filters="clearFilters"
@close="showFilters= !showFilters"
Expand Down Expand Up @@ -146,6 +147,11 @@ export default {
required: false,
default: () => null
},
isDistrict: {
type: Boolean,
required: false,
default: false
},
showExportBtn: {
type: Boolean,
required: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
:config="indySchoolsNameNumberFilter != null ? configSchools : configDistricts"
:collection-object="collectionObject"
:indy-school-district-object="indySchoolDistrictObject"
:is-district="isDistrict"
:show-export-btn="true"
:read-only="true"
/>
Expand Down Expand Up @@ -84,6 +85,7 @@ export default {
configDistricts: FTE_DISTRICT,
configSchools: FTE_SCHOOL,
indySchoolDistrictObject: null,
isDistrict: false,
};
},
computed: {
Expand All @@ -99,8 +101,10 @@ export default {
setIndySchoolsDistrictsNameNumberFilter(key, $event) {
if ($event) {
this.indySchoolDistrictObject = { type: key, id: $event };
this.isDistrict = key === 'district';
} else {
this.indySchoolDistrictObject = null;
this.isDistrict = false;
}
},
setupIndySchoolsDistrictsList() {
Expand Down
Loading

0 comments on commit ba0514f

Please sign in to comment.