I have two observables
one is a list of available courses and one is a list of coursework completed. My task is it create a list of courses that can be taken next. The problem is when I do a filter I can find where the compare is true easy enough but I can't figure out how to get the inverse list.
Here is my current function
public CourseList(): Observable < ICourse[] > {
return this.CourseworkServ.Read()
.pipe(
switchMap((CurrentCourses: IResponseObject < ICourseworkData > ) => {
return this.CourseServ.Read(this.SelectedDepartment.Id)
.pipe(
map((CourseList: IResponseObject < ICourse > ) => CourseList.Array.filter((CheckCourse: ICourse) => CurrentCourses.Array.some(({
Id,
Edition,
Institution,
Department,
Course
}) => CheckCourse.Id === Id)))
)
})
)
}
This function will show courses taken from the list of courses, what I need is a list of courses not taken. But if I can't just use the !==
in the Id compare because the result would never be true. I need something like an inverse filter or something like that. Does anyone have any suggestions on how to fix this?