Skip to content

Commit

Permalink
Dev review comments - UX changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sumathi-thirumani committed Nov 6, 2024
1 parent 70b4d57 commit 8ab1b71
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 130 deletions.
34 changes: 6 additions & 28 deletions backend/src/components/eas/studentFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ function createMoreFiltersSearchCriteria(searchFilter = []) {
let districtNameNumberFilter = [];
let schoolNameNumberFilter = [];
let assessmentCenterNameNumberFilter = [];
let scoreRangeList = [];

for (const [key, filter] of Object.entries(searchFilter)) {
let pValue = filter ? filter.map(filter => filter.value) : null;

//Default Filter Begin
if (key === 'schoolYear' && pValue) {
searchCriteriaList.push({ key: 'assessmentEntity.sessionEntity.schoolYear', value: pValue[0].replace('-', '/'), operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.AND });
}

if (key === 'sessionID' && pValue) {
searchCriteriaList.push({ key: 'assessmentEntity.sessionEntity.sessionID', value: pValue[0], operation: FILTER_OPERATION.IN, valueType: VALUE_TYPE.UUID, condition: CONDITION.AND });
}

}
//Default Filter End

if (key === 'surName' && pValue) {
Expand Down Expand Up @@ -50,7 +44,7 @@ function createMoreFiltersSearchCriteria(searchFilter = []) {
assessmentCenterNameNumberFilter = [...schoolNameNumberCriteria];
}

if (key === 'sessions' && pValue) {
if (key === 'session' && pValue) {
searchCriteriaList.push({ key: 'assessmentEntity.sessionEntity.sessionID', value: pValue.toString(), operation: FILTER_OPERATION.IN, valueType: VALUE_TYPE.UUID, condition: CONDITION.AND });
}

Expand All @@ -64,14 +58,14 @@ function createMoreFiltersSearchCriteria(searchFilter = []) {

if (key === 'proficienyScore' && pValue) {
if(JSON.parse(pValue) === true) {
searchCriteriaList.push({ key: 'proficiencyScore', value: 0, operation: FILTER_OPERATION.GREATER_THAN, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND });
searchCriteriaList.push({ key: 'proficiencyScore', value: 0, operation: FILTER_OPERATION.NOT_EQUAL, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND });
} else {
searchCriteriaList.push({ key: 'proficiencyScore', value:0, operation: FILTER_OPERATION.LESS_THAN_OR_EQUAL_TO, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND });
searchCriteriaList.push({ key: 'proficiencyScore', value:0, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND });
}
}

if (key === 'proficienyScoreRange' && pValue) {
scoreRangeList = createScoreRangeFilter(pValue);
if (key === 'proficienyScoreValue' && pValue) {
searchCriteriaList.push({ key: 'proficiencyScore', value: pValue.toString(), operation: FILTER_OPERATION.IN, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND });
}

}
Expand All @@ -94,12 +88,6 @@ function createMoreFiltersSearchCriteria(searchFilter = []) {
searchCriteriaList: assessmentCenterNameNumberFilter
});
}
if(scoreRangeList.length > 0) {
search.push({
condition: CONDITION.AND,
searchCriteriaList: scoreRangeList
});
}
if (searchCriteriaList.length > 0) {
search.push({
condition: CONDITION.AND,
Expand Down Expand Up @@ -151,16 +139,6 @@ function createAssessmentCenterNameNumberSearchCriteria(value) {
return searchAssessmentCenterCriteriaList;
}

function createScoreRangeFilter(pValue) {
let scoreRangeList = [];

scoreRangeList.push({key:'proficiencyScore', value: pValue[0][1], operation: FILTER_OPERATION.LESS_THAN_OR_EQUAL_TO, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND});
scoreRangeList.push({key:'proficiencyScore', value: pValue[0][0], operation: FILTER_OPERATION.GREATER_THAN_OR_EQUAL_TO, valueType: VALUE_TYPE.INTEGER, condition: CONDITION.AND});
if(pValue[0][0] === '0'){
scoreRangeList.push({key:'proficiencyScore', value: null, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.STRING, condition: CONDITION.OR});
}
return scoreRangeList;
}

module.exports = {
createMoreFiltersSearchCriteria
Expand Down
23 changes: 4 additions & 19 deletions frontend/src/components/assessments/AssessmentSessionsDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
<v-container class="containerSetup" :fluid="true">
<v-row class="d-flex justify-start">
<v-col>
<h2 class="subjectHeading">School Year {{ schoolYear.replace('-','/') }}</h2>
<h2 class="subjectHeading">School Year: {{ schoolYear.replace('-','/') }}</h2>
</v-col>
</v-row>
<v-row v-if="sessionID" no-gutters class="mt-1 d-flex justify-start">
<v-col>
<h4>{{ formatMonth(this.activeSession?.courseMonth) }} {{ activeSession?.courseYear }}</h4>
</v-col>
</v-row>
</v-row>
<v-row no-gutters class="mt-2 mb-2 d-flex justify-start">
<v-col class="mt-1 d-flex justify-start">
<v-icon small color="#1976d2"> mdi-arrow-left </v-icon>
Expand Down Expand Up @@ -51,7 +46,6 @@ import StudentRegistrations from './registrations/StudentRegistrations.vue';
import Spinner from '@/components/common/Spinner.vue';
import ApiService from '../../common/apiService';
import { Routes } from '../../utils/constants';
import moment from 'moment';
export default {
name: 'AssessmentSessionDetail',
Expand All @@ -74,7 +68,6 @@ export default {
data() {
return {
assessmentStudents: [],
activeSession: null,
schoolYearSessions: [],
isLoading: false,
tab: ''
Expand All @@ -95,23 +88,15 @@ export default {
{}
)
.then((response) => {
this.schoolYearSessions = response.data;
if (this.sessionID) {
this.activeSession = this.schoolYearSessions.find(
(session) => session.sessionID === this.sessionID
);
}
this.schoolYearSessions = response.data;
})
.catch((error) => {
console.error(error);
})
.finally(() => {
this.loading = false;
});
},
formatMonth(month) {
return moment(month, 'MM').format('MMMM');
},
},
backToAssesmentSessions() {
this.$router.push({ name: 'assessment-sessions' });
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<StudentRegistrationsFilter
:filters="config.allowedFilters"
:school-year-sessions="schoolYearSessions"
:initial-filter-selection="filterSearchParams?.moreFilters"
@apply-assessment-filters="applyFilters"
@clear-assessment-filters="clearFilters"
@close-assessment-filter="showFilters = !showFilters"
Expand All @@ -76,6 +77,7 @@ import ApiService from '@/common/apiService';
import { Routes } from '@/utils/constants';
import { cloneDeep, isEmpty, omitBy } from 'lodash';
import StudentRegistrationsFilter from './StudentRegistrationsFilter.vue';
import moment from 'moment';
export default {
name: 'StudentRegistrations',
Expand Down Expand Up @@ -122,20 +124,27 @@ export default {
},
},
created() {
this.applydefaultFilers();
this.getAssessmentStudents();
},
methods: {
applydefaultFilers() {
if (this.sessionID) {
const activeSession = this.schoolYearSessions.find(
(session) => session.sessionID === this.sessionID
);
this.filterSearchParams.moreFilters.session = [
{ title: moment(activeSession.courseMonth, 'MM').format('MMMM') , id: activeSession.sessionID, value: activeSession.sessionID },
];
}
},
getAssessmentStudents() {
this.loading = true;
let sort = {
assessmentStudentID: 'ASC',
};
let assessmentSearchParams = cloneDeep(this.filterSearchParams);
if (this.sessionID) {
assessmentSearchParams.moreFilters.sessionID = [
{ title: 'sessionID', id: 'sessionID', value: this.sessionID },
];
} else {
if (! this.sessionID) {
assessmentSearchParams.moreFilters.schoolYear = [
{ title: 'schoolYear', id: 'schoolYear', value: this.schoolYear },
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,20 @@
</v-row>
</div>
<div v-for="(filter, key) in filters" :key="key">
<v-row>
<v-row v-if="filter?.heading">
<v-col :id="filter.id" class="filter-heading">
{{ filter?.heading }}
</v-col>
</v-row>
<v-row v-else class="filter-heading"/>
<v-row>
<v-btn-toggle
v-model="selected[key]"
color="#003366"
rounded="0"
:multiple="filter?.multiple"
class="filter-toggle"
@update:model-value="setFilter(selected[key], key)"
@update:model-value="setFilter(selected[key], key)"
>
<div v-if="filter?.id === 'sessionTypeCode'">
<span
Expand Down Expand Up @@ -222,66 +223,7 @@
{{ option?.title }}
</v-btn>
</span>
</div>
<div v-else-if="filter?.id === 'proficiencyScore'">
<span v-for="(option, i) in filter?.filterOptions"
:key="option.value"
>
<v-btn
:id="option?.id"
:value="option"
class="filter-button"
rounded="lg"
>
{{ option?.title }}
</v-btn>
</span>
<v-range-slider
id="score-slider"
v-model="scoreRange"
:min="scoreRangeDefault[0]"
:max="scoreRangeDefault[1]"
:step="1"
color="#003366"
hide-details
:strict="true"
thumb-size="15"
class="align-center"
@end="setScoreRangeFilter('proficienyScoreRange', $event)"
>
<template #prepend>
<v-text-field
v-model="scoreRange[0]"
hide-details
single-line
type="number"
:step="1"
:min="scoreRangeDefault[0]"
:max="scoreRange[1]"
variant="outlined"
density="compact"
class="slider-text"
:readonly="true"
@update:model-value="setScoreRangeFilter('proficienyScoreRange', scoreRange)"
/>
</template>
<template #append>
<v-text-field
v-model="scoreRange[1]"
hide-details
single-line
type="number"
:min="scoreRange[0]"
:max="scoreRangeDefault[1]"
variant="outlined"
density="compact"
class="slider-text"
:readonly="true"
@update:model-value="setCourseRangeFilter('proficienyScoreRange', scoreRange)"
/>
</template>
</v-range-slider>
</div>
</div>
<div v-else>
<span
v-for="(option, i) in filter?.filterOptions"
Expand Down Expand Up @@ -329,6 +271,11 @@ export default {
type: Object,
required: true,
default: null,
},
initialFilterSelection: {
type: Object,
required: true,
default: null
}
},
emits: ['clear-assessment-filters', 'apply-assessment-filters', 'close-assessment-filter'],
Expand All @@ -353,10 +300,11 @@ export default {
},
computed: {
...mapState(appStore, ['districtMap', 'schoolMap', 'config']),
...mapState(authStore, ['userInfo']),
...mapState(authStore, ['userInfo']),
},
watch: {},
async beforeMount() {
this.selected = {...this.initialFilterSelection};
if (this.schoolMap.size === 0) {
await appStore().getInstituteCodes();
}
Expand Down Expand Up @@ -548,14 +496,4 @@ export default {
height: auto !important;
}
#score-slider {
margin: 0 8px 8px 8px;
}
.slider-text {
width: 5em;
font-size: 0.875rem;
border-color: #003366;
text-align: center;
}
</style>
Loading

0 comments on commit 8ab1b71

Please sign in to comment.