Skip to content
This repository was archived by the owner on Jul 27, 2024. It is now read-only.

Commit ef02272

Browse files
committed
add course type to huji import + add more coursetype colors
1 parent 9709953 commit ef02272

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

Closure_Front_End/src/components/CourseBox.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ export default {
2828
2929
methods: {
3030
colorMatch() {
31-
if (this.course.type == 1) return "must";
32-
if (this.course.type == 2) return "choose_from_list";
31+
if (this.course.type === "MUST") return "must";
32+
if (this.course.type === "CHOOSE_FROM_LIST") return "choose_from_list";
33+
if (this.course.type === "CORNER_STONE") return "corner_stone";
34+
if (this.course.type === "SUPPLEMENTARY") return "supplementary";
3335
return "choice";
3436
},
3537
},
@@ -63,6 +65,14 @@ export default {
6365
color: #fbaf5d;
6466
}
6567
68+
.corner_stone {
69+
color: #69d85e;
70+
}
71+
72+
.supplementary {
73+
color: #bfbfbf;
74+
}
75+
6676
.choice {
6777
color: #f06eaa;
6878
}

Closure_Front_End/src/huji-import/CandidateCourses.vue

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@
1717
<strong>{{ambiguousCourses.length}}</strong>
1818
מהקורסים, יש לבחור ידנית את הסמסטר
1919
</div>
20+
<div class="notification is-warning" v-if="!isTrackDefined">
21+
לא הוגדר מסלול עבור המשתמש, אז סוגי הקורסים אינם מוגדרים.
22+
</div>
23+
<div class="notification" v-if="isTrackDefined">
24+
סוגי הקורסים הם ביחס למסלול המוגדר אצל המשתמש,
25+
<strong>{{trackName}}</strong>
26+
</div>
2027
<table class="table">
2128
<thead>
2229
<tr>
2330
<th>מספר קורס</th>
2431
<th>שם קורס</th>
2532
<th>נקודות זכות</th>
33+
<th>סוג</th>
2634
<th>סמסטר</th>
2735
</tr>
2836
</thead>
@@ -32,6 +40,7 @@
3240
<td>{{ course.course_id }}</td>
3341
<td>{{ course.name }}</td>
3442
<td>{{ course.points }}</td>
43+
<td>{{ displayCourseType(course) }}</td>
3544
<td>
3645
<div class="control">
3746
<label class="radio">
@@ -83,6 +92,15 @@
8392

8493
<script>
8594
import { courses as currentCourses } from '@/course-store.js'
95+
96+
const MODEL_COURSE_TYPE_TO_STRING = new Map([
97+
["MUST", "חובה"],
98+
["CHOICE", "בחירה"],
99+
["CHOOSE_FROM_LIST", "בחירה מרשימה"],
100+
["CORNER_STONE", "אבן פינה"],
101+
["SUPPLEMENTARY", "משלים"]
102+
])
103+
86104
export default {
87105
props: {
88106
courses: Array,
@@ -105,8 +123,25 @@ export default {
105123
*/
106124
currentlySavedCoursesCount() {
107125
return currentCourses.length
126+
},
127+
128+
isTrackDefined() {
129+
return !!this.studentAndClaims.student.track
130+
},
131+
132+
trackName() {
133+
return this.studentAndClaims.student.track?.name ?? "לא מוגדר"
134+
}
135+
},
136+
methods: {
137+
displayCourseType(course) {
138+
if (!MODEL_COURSE_TYPE_TO_STRING.has(course.type)) {
139+
return "לא ידוע";
140+
}
141+
return MODEL_COURSE_TYPE_TO_STRING.get(course.type);
108142
}
109143
},
144+
inject: ['studentAndClaims'],
110145
data() { return {
111146
importMode: 'combine'
112147
}

Closure_Front_End/src/huji-import/ParsedCoursesTables.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const processCourses = async (parsedCourses, http) => {
3030
console.error(res.data.results)
3131
}
3232
const gottenCourse = res.data.results[0]
33-
const finalCourse = { ... course, name: gottenCourse.name }
33+
const finalCourse = { ... course, name: gottenCourse.name, type: gottenCourse.type }
3434
if (["FIRST", "SECOND"].includes(gottenCourse.semester)) {
3535
if (course.semester && course.semester !== gottenCourse.semester) {
3636
console.warn(`Course ${course.course_id} - ${course.name} at year ${course.year} is offered only in semester `

0 commit comments

Comments
 (0)