From c85d0e895ea7dfeedfa03f2d4123ea916b8ff9c4 Mon Sep 17 00:00:00 2001
From: snoopy0328 <144743638+snoopy0328@users.noreply.github.com>
Date: Fri, 6 Oct 2023 20:10:12 -0400
Subject: [PATCH 1/3] Update Header.vue
commented a general idea on how I will fix the order of the schedule
---
src/web/src/components/Header.vue | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/web/src/components/Header.vue b/src/web/src/components/Header.vue
index 72ef79e28..fd8144a06 100644
--- a/src/web/src/components/Header.vue
+++ b/src/web/src/components/Header.vue
@@ -20,11 +20,20 @@
:text="selectedSemester"
class="m-md-2"
>
+
+
+
+
{{ option.value }}
@@ -221,6 +230,7 @@ export default {
}),
...mapState({ sessionId: userTypes.state.SESSION_ID }),
...mapState(["semesters", "selectedSemester"]),
+//possibility where I can reorder the semesters
semesterOptions() {
return this.semesters.map(({ semester }) => ({
text: semester,
From 1752fa138ec7e95234807d25d39a872ce000b9d7 Mon Sep 17 00:00:00 2001
From: snoopy0328 <144743638+snoopy0328@users.noreply.github.com>
Date: Fri, 13 Oct 2023 20:13:24 -0400
Subject: [PATCH 2/3] SortedSemester funciton
---
src/web/src/components/Header.vue | 33 +++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/web/src/components/Header.vue b/src/web/src/components/Header.vue
index fd8144a06..43e08ff85 100644
--- a/src/web/src/components/Header.vue
+++ b/src/web/src/components/Header.vue
@@ -19,21 +19,14 @@
size="sm"
:text="selectedSemester"
class="m-md-2"
+
+
>
-
-
-
-
{{ option.value }}
@@ -237,6 +230,26 @@ export default {
value: semester,
}));
},
+ sortedSemesterOptions() {
+ // Sort the semesterOptions array by year and semester
+ return this.semesterOptions.slice().sort((a, b) => {
+ // Extract year and semester from the value (e.g., "Fall 2023")
+ const yearA = a.value.split(' ')[1];
+ const yearB = b.value.split(' ')[1];
+
+ // Compare years
+ if (yearA !== yearB) {
+ return yearA - yearB; // Assuming years are integers
+ }
+
+ // If years are the same, compare semesters
+ const semesterOrder = ['Spring', 'Summer', 'Fall']; // Define the order of semesters
+ const semesterA = semesterOrder.indexOf(a.value.split(' ')[0]);
+ const semesterB = semesterOrder.indexOf(b.value.split(' ')[0]);
+
+ return semesterA - semesterB;
+ });
+ },
},
};
From e8c37a4a471433dc36815b55e88d97f4fed4aed5 Mon Sep 17 00:00:00 2001
From: snoopy0328 <144743638+snoopy0328@users.noreply.github.com>
Date: Wed, 29 Nov 2023 19:51:23 -0500
Subject: [PATCH 3/3] Update Header.vue
sorting of selected semesters in header
---
src/web/src/components/Header.vue | 38 ++++++++++++++-----------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/src/web/src/components/Header.vue b/src/web/src/components/Header.vue
index 43e08ff85..1afdc6289 100644
--- a/src/web/src/components/Header.vue
+++ b/src/web/src/components/Header.vue
@@ -225,31 +225,26 @@ export default {
...mapState(["semesters", "selectedSemester"]),
//possibility where I can reorder the semesters
semesterOptions() {
- return this.semesters.map(({ semester }) => ({
- text: semester,
- value: semester,
- }));
+ return this.semesters
+ .map(({ semester }) => ({
+ text: semester,
+ value: semester,
+ }))
},
sortedSemesterOptions() {
- // Sort the semesterOptions array by year and semester
- return this.semesterOptions.slice().sort((a, b) => {
- // Extract year and semester from the value (e.g., "Fall 2023")
- const yearA = a.value.split(' ')[1];
- const yearB = b.value.split(' ')[1];
-
- // Compare years
- if (yearA !== yearB) {
- return yearA - yearB; // Assuming years are integers
- }
-
- // If years are the same, compare semesters
- const semesterOrder = ['Spring', 'Summer', 'Fall']; // Define the order of semesters
- const semesterA = semesterOrder.indexOf(a.value.split(' ')[0]);
- const semesterB = semesterOrder.indexOf(b.value.split(' ')[0]);
+ return [...this.semesterOptions].sort((a, b) => {
+ const [semesterA, yearA] = a.value.split(' ').map(s => s.trim().toLowerCase());
+ const [semesterB, yearB] = b.value.split(' ').map(s => s.trim().toLowerCase());
- return semesterA - semesterB;
+ // Compare by year
+ if (yearA > yearB) return -1;
+ if (yearA < yearB) return 1;
+
+ // If year is the same, compare by semester
+ const order = ['fall', 'summer', 'spring'];
+ return order.indexOf(semesterA) - order.indexOf(semesterB);
});
- },
+ }
},
};
@@ -301,3 +296,4 @@ export default {
background: hsl(211, 100%, 60%) !important;
}
+