Unverified Commit 0edd35e5 authored by Estelle Veisemburger's avatar Estelle Veisemburger Committed by Florent Chehab
Browse files

feat(filter): using majorMinorMappings in the filter

parent 0c322690
import { getMostNRecentSemesters } from "../utils/compareSemesters";
import UniversityService from "./data/UniversityService";
import CountryService from "./data/CountryService";
import { getUpdatedMajor, getUpdatedMinor } from "../utils/majorMinorMappings";
/**
* Class that handle all the filter manipulation with caching
......@@ -50,7 +51,7 @@ class FilterService {
}));
this._destinationOpenCount = universities.filter(
u => u.denormalized_infos.is_destination_open === true
(u) => u.denormalized_infos.is_destination_open === true
).length;
}
......@@ -110,20 +111,17 @@ class FilterService {
allowedSemesters === null ? true : allowedSemesters.includes(sem)
)
.map(([, forSemester]) => forSemester)
.flatMap(forSemester => Object.entries(forSemester))
.flatMap((forSemester) => Object.entries(forSemester))
.flatMap(([major, minors]) =>
minors.map(minor => {
if (major === "GSM" || major === "GM") {
major = "IM";
}
return `${major}${minor}`;
minors.map((minor) => {
const maj = getUpdatedMajor(major);
const min = getUpdatedMinor(major, minor);
return `${maj}${min}`;
})
);
const extraMinors = this.getMajorInUniv(univObj).map(major => {
if (major === "GSM" || major === "GM") {
major = "IM";
}
const extraMinors = this.getMajorInUniv(univObj).map((major) => {
major = getUpdatedMajor(major);
return `${major} — Toutes filières confondues`;
});
return [...new Set(realMinors), ...extraMinors];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment