Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search issue #623

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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