Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
0edd35e5
Unverified
Commit
0edd35e5
authored
May 15, 2020
by
Estelle Veisemburger
Committed by
Florent Chehab
May 24, 2020
Browse files
feat(filter): using majorMinorMappings in the filter
parent
0c322690
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/services/FilterService.js
View file @
0edd35e5
import
{
getMostNRecentSemesters
}
from
"
../utils/compareSemesters
"
;
import
{
getMostNRecentSemesters
}
from
"
../utils/compareSemesters
"
;
import
UniversityService
from
"
./data/UniversityService
"
;
import
UniversityService
from
"
./data/UniversityService
"
;
import
CountryService
from
"
./data/CountryService
"
;
import
CountryService
from
"
./data/CountryService
"
;
import
{
getUpdatedMajor
,
getUpdatedMinor
}
from
"
../utils/majorMinorMappings
"
;
/**
/**
* Class that handle all the filter manipulation with caching
* Class that handle all the filter manipulation with caching
...
@@ -50,7 +51,7 @@ class FilterService {
...
@@ -50,7 +51,7 @@ class FilterService {
}));
}));
this
.
_destinationOpenCount
=
universities
.
filter
(
this
.
_destinationOpenCount
=
universities
.
filter
(
u
=>
u
.
denormalized_infos
.
is_destination_open
===
true
(
u
)
=>
u
.
denormalized_infos
.
is_destination_open
===
true
).
length
;
).
length
;
}
}
...
@@ -110,20 +111,17 @@ class FilterService {
...
@@ -110,20 +111,17 @@ class FilterService {
allowedSemesters
===
null
?
true
:
allowedSemesters
.
includes
(
sem
)
allowedSemesters
===
null
?
true
:
allowedSemesters
.
includes
(
sem
)
)
)
.
map
(([,
forSemester
])
=>
forSemester
)
.
map
(([,
forSemester
])
=>
forSemester
)
.
flatMap
(
forSemester
=>
Object
.
entries
(
forSemester
))
.
flatMap
(
(
forSemester
)
=>
Object
.
entries
(
forSemester
))
.
flatMap
(([
major
,
minors
])
=>
.
flatMap
(([
major
,
minors
])
=>
minors
.
map
(
minor
=>
{
minors
.
map
((
minor
)
=>
{
if
(
major
===
"
GSM
"
||
major
===
"
GM
"
)
{
const
maj
=
getUpdatedMajor
(
major
);
major
=
"
IM
"
;
const
min
=
getUpdatedMinor
(
major
,
minor
);
}
return
`
${
maj
}
—
${
min
}
`
;
return
`
${
major
}
—
${
minor
}
`
;
})
})
);
);
const
extraMinors
=
this
.
getMajorInUniv
(
univObj
).
map
(
major
=>
{
const
extraMinors
=
this
.
getMajorInUniv
(
univObj
).
map
((
major
)
=>
{
if
(
major
===
"
GSM
"
||
major
===
"
GM
"
)
{
major
=
getUpdatedMajor
(
major
);
major
=
"
IM
"
;
}
return
`
${
major
}
— Toutes filières confondues`
;
return
`
${
major
}
— Toutes filières confondues`
;
});
});
return
[...
new
Set
(
realMinors
),
...
extraMinors
];
return
[...
new
Set
(
realMinors
),
...
extraMinors
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment