From 0dd271b2e979e12f4755c2bb36e961e3ca5dc54b Mon Sep 17 00:00:00 2001 From: Ryzon3 Date: Tue, 9 Aug 2022 13:54:38 -0400 Subject: [PATCH] FIxed multi year bugs --- frontend/src/App.vue | 14 +------ frontend/src/components/Bookmark.vue | 1 - frontend/src/components/CourseTable.vue | 20 +++++++++- frontend/src/components/CourseTableCourse.vue | 22 +++++----- .../src/components/DarkLightModeButton.vue | 11 +++-- frontend/src/components/Header.vue | 8 ++-- frontend/src/components/MyPathway.vue | 26 +++++++----- frontend/src/components/PathwayCategory.vue | 10 +++-- frontend/src/components/YearSelection.vue | 3 +- frontend/src/data/data.js | 8 ---- .../src/pages/AdminPortal/AdminCoursePage.vue | 17 +++++--- .../pages/AdminPortal/AdminPathwayPage.vue | 21 ++++++---- .../src/pages/FromClasses/FromClassesPage.vue | 40 ++++++++++++++----- .../pages/FromClasses/FromClassesPathways.vue | 12 ++++-- frontend/src/pages/Pathway/PathwayPage.vue | 36 ++++++++++++++--- frontend/src/router/index.js | 10 ++--- 16 files changed, 164 insertions(+), 95 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index a3d73766..2ab9338e 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,6 +1,6 @@ diff --git a/frontend/src/components/MyPathway.vue b/frontend/src/components/MyPathway.vue index 397ce486..5c4574e9 100644 --- a/frontend/src/components/MyPathway.vue +++ b/frontend/src/components/MyPathway.vue @@ -45,7 +45,7 @@
-
There are pre-requisite(s) for this course:
- - {{prereq}} +
There are pre-requisite(s) for this course:
+ + {{ prereq }}
@@ -95,7 +95,7 @@ diff --git a/frontend/src/components/YearSelection.vue b/frontend/src/components/YearSelection.vue index 52c25035..1f35ee1c 100644 --- a/frontend/src/components/YearSelection.vue +++ b/frontend/src/components/YearSelection.vue @@ -29,7 +29,8 @@ export default { }, methods: { updateYear() { - this.$store.commit('changeYear',this.selection) + this.$store.commit('changeYear', this.selection); + location.reload(); } } } diff --git a/frontend/src/data/data.js b/frontend/src/data/data.js index a3bbcb30..21b3f2bc 100644 --- a/frontend/src/data/data.js +++ b/frontend/src/data/data.js @@ -1,21 +1,13 @@ import pathwayCategoriesJSON from './json/pathway_categories.json' import yearsJSON from './json/years.json' -import store from '../store/store.js' - -import coursesJSON from './json/2021-2022/courses.json' -import pathwaysJSON from './json/2021-2022/pathways.json' // Neatify JSON data: // Sort pathways in pathway categories pathwayCategoriesJSON.forEach(category => category.pathways.sort()); // Prevent accidental modification -Object.freeze(coursesJSON); -Object.freeze(pathwaysJSON); Object.freeze(yearsJSON); Object.freeze(pathwayCategoriesJSON); -export const pathways = pathwaysJSON; export const pathwayCategories = pathwayCategoriesJSON; export const years = yearsJSON; -export const courses = coursesJSON; diff --git a/frontend/src/pages/AdminPortal/AdminCoursePage.vue b/frontend/src/pages/AdminPortal/AdminCoursePage.vue index f2d6ead3..0b2f1cc3 100644 --- a/frontend/src/pages/AdminPortal/AdminCoursePage.vue +++ b/frontend/src/pages/AdminPortal/AdminCoursePage.vue @@ -122,7 +122,6 @@ import Breadcrumbs from '../../components/Breadcrumbs' import breadcrumbs from '../../data/breadcrumbs.js' import axios from 'axios' -import { courses, pathways } from '../../data/data.js' export default { components: { @@ -147,6 +146,8 @@ export default { minors: [], myPathways: [], pathways: [], + pathwaysData: {}, + coursesData: {}, rules: { courseCode: value => ('' + value).length === 4 @@ -172,6 +173,10 @@ export default { } }, created() { + const year = this.$store.state.year; + import('../../data/json/' + year + '/pathways.json').then((val) => this.pathwaysData = Object.freeze(val)); + import('../../data/json/' + year + '/courses.json').then((val) => this.coursesData = Object.freeze(val)); + const course = this.getCourse(); if(course) { this.name = course.name; @@ -189,8 +194,8 @@ export default { this.odd = course.offered.odd; } let myPathways = new Set(); - for(const key in pathways) { - const singlePathway = pathways[key]; + for(const key in this.pathwaysData) { + const singlePathway = this.pathwaysData[key]; if(course) { for(const prio in singlePathway) { if(singlePathway[prio] instanceof Object && !(singlePathway[prio] instanceof Array)) { @@ -211,8 +216,10 @@ export default { if(!this.$route.query.class) { return null; } - - return courses[this.$route.query.class]; + if(!this.coursesData[this.$route.query.class]) { + return null; + } + return this.coursesData[this.$route.query.class]; }, submit() { let newCourse = this.getCourse(); diff --git a/frontend/src/pages/AdminPortal/AdminPathwayPage.vue b/frontend/src/pages/AdminPortal/AdminPathwayPage.vue index 8f38634a..f3a95035 100644 --- a/frontend/src/pages/AdminPortal/AdminPathwayPage.vue +++ b/frontend/src/pages/AdminPortal/AdminPathwayPage.vue @@ -101,7 +101,6 @@ diff --git a/frontend/src/pages/Pathway/PathwayPage.vue b/frontend/src/pages/Pathway/PathwayPage.vue index 616aa0ce..e100fbaf 100644 --- a/frontend/src/pages/Pathway/PathwayPage.vue +++ b/frontend/src/pages/Pathway/PathwayPage.vue @@ -42,6 +42,7 @@ :pathway-id="pathwayID" :desc="false" :search-bar="false" + :has-data="hasData" :graph="true" :hover="hover" :category="item[0]" @@ -62,6 +63,7 @@ :pathway-id="pathwayID" :desc="false" :search-bar="false" + :has-data="hasData" :graph="true" :hover="hover" :category="item[0]" @@ -142,6 +144,7 @@ :ref="index" :courses="courses[item[1]]" :pathway-id="pathwayID" + :has-data="hasData" :show-desc="true" :category="item[0]" @checkbox-clicked="onCheckboxClicked" @@ -153,7 +156,7 @@