From 7383e5b723535d1c82bb05d45fecf08fec89b9bd Mon Sep 17 00:00:00 2001 From: Eckerman Date: Thu, 14 Sep 2023 15:08:29 -0700 Subject: [PATCH] move grade options creation to institute module --- .../components/common/forms/SchoolDetailsForm.vue | 13 +------------ frontend/src/store/modules/institute.js | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/common/forms/SchoolDetailsForm.vue b/frontend/src/components/common/forms/SchoolDetailsForm.vue index 6914daef8..1cec8cbd2 100644 --- a/frontend/src/components/common/forms/SchoolDetailsForm.vue +++ b/frontend/src/components/common/forms/SchoolDetailsForm.vue @@ -1089,17 +1089,6 @@ export default { }, isGradeOfferedUpdateAllowed() { return this.school.schoolCategoryCode !== 'INDP_FNS' && this.school.schoolCategoryCode !== 'INDEPEND'; - }, - gradeOptions(){ - const gradeOptionList = []; - for (let i=0; i < this.gradeCodes.length; i++){ - if((this.school.schoolCategoryCode !== 'INDP_FNS' && this.school.schoolCategoryCode !== 'INDEPEND' && this.gradeCodes[i].schoolGradeCode === 'KINDHALF') || - (this.gradeCodes[i].schoolGradeCode === 'ELEMUNGR' || this.gradeCodes[i].schoolGradeCode === 'SECUNGR')){ - continue; - } - gradeOptionList.push(this.gradeCodes[i]); - } - return gradeOptionList; } }, watch: { @@ -1401,7 +1390,7 @@ export default { sortGrades() { const gradeList = []; for (const grade of this.schoolGradeTypes) { - if (this.schoolDetailsCopy.grades.find((rawGrade) => rawGrade.schoolGradeCode === grade.schoolGradeCode)) { + if (this.schoolDetailsCopy.grades.find((rawGrade) => rawGrade.schoolGradeCode === grade.schoolGradeCode )) { gradeList.push(grade); } } diff --git a/frontend/src/store/modules/institute.js b/frontend/src/store/modules/institute.js index d8484ca43..df6c28401 100644 --- a/frontend/src/store/modules/institute.js +++ b/frontend/src/store/modules/institute.js @@ -41,7 +41,7 @@ export const instituteStore = defineStore('institute', { independentAuthoritySchoolContacts: state => state.schoolContactTypeCodes?.filter(type => !type.offshoreOnly), offshoreSchoolContacts: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly), regularSchoolContactTypes: state => state.schoolContactTypeCodes?.filter(type => !type.indOnly && !type.offshoreOnly), - gradeOptions: state => state.gradeCodes.filter(grade => !['KINDHALF', 'ELEMENUNGR', 'SECUNGR'].includes(grade) ) + gradeOptions: state => state.gradeCodes?.filter(grade => !['KINDHALF', 'ELEMUNGR', 'SECUNGR'].includes(grade.schoolGradeCode)) }, actions: { async setFacilityTypeCodes(facilityTypeCodes) {