File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ export const model = {
2424 applyCreditsFilter :true ,
2525 creditMin : 0 ,
2626 creditMax : 45 ,
27- //applyDepartmentFilter:false,
27+ applyDepartmentFilter :false ,
28+ department : [ ]
2829 } ,
2930
3031 setUser ( user ) {
Original file line number Diff line number Diff line change @@ -267,6 +267,33 @@ const FilterPresenter = observer(({ model }) => {
267267 }
268268 localFilteredCourses = [...stayingCourses];*/
269269 }
270+
271+ function updateDepartments ( ) {
272+ const deparments = model . filterOptions . deparment ;
273+ let bestCourses = [ ] ;
274+ let worstCourses = [ ] ;
275+
276+ bestCourses = localFilteredCourses . filter ( function ( course ) {
277+ try {
278+ return ( deparments . includes ( course . deparment ) ) ;
279+ } catch ( error ) {
280+ console . log ( "for some reason course.department is: " , course ?. department , error ) ;
281+ return false ;
282+ }
283+
284+ } ) ;
285+ worstCourses = localFilteredCourses . filter ( function ( course ) {
286+ try {
287+ return ( ( course ?. department === undefined ) || ( course ?. deparment === "null" ) ) ;
288+ } catch ( error ) {
289+ console . log ( "BIG ERROR" , error ) ;
290+ return false ;
291+ }
292+
293+ } ) ;
294+
295+ localFilteredCourses = [ ...bestCourses , ...worstCourses ] ;
296+ }
270297
271298 if ( model . filtersChange ) {
272299 localFilteredCourses = [ ...model . courses ] ;
@@ -289,6 +316,10 @@ const FilterPresenter = observer(({ model }) => {
289316 if ( model . filterOptions . applyTranscriptFilter ) {
290317 applyTranscriptEligibility ( ) ;
291318 }
319+ if ( model . filterOptions . applyDepartments ) {
320+ //console.log("going to apply location on:",localFilteredCourses.length);
321+ //updateDepartments();
322+ }
292323
293324 model . filteredCourses = [ ...localFilteredCourses ] ;
294325 model . filtersChange = false ;
You can’t perform that action at this time.
0 commit comments