Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/web/src/components/CourseList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ export default {
? this.courseList
: this.$store.getters.courses;


//filter finds out the departmemt first

// filter by selected department
const filtered = courses.filter(
(course) =>
Expand All @@ -187,15 +190,20 @@ export default {
);

// returns exact match, if not found, then department filtered list
const find = filtered.find(
const find = filtered.filter
(
//full_title: names of classes
(course) =>
(course.full_title &&
course.full_title.toUpperCase() ===
this.textSearch.toUpperCase()) ||
course.title.toUpperCase() === this.textSearch.toUpperCase()
);
(course.full_title &&
course.full_title.toUpperCase().includes(this.textSearch.toUpperCase()) ||
course.title.toUpperCase().includes(this.textSearch.toUpperCase()) ||
course.department.toUpperCase().includes(this.textSearch.toUpperCase()))||
course.level.toString().includes(this.textSearch)
);

console.log(find);

if (find) return [find];
if (find) return find;
else return filtered;
},
},
Expand Down