Skip to content
Snippets Groups Projects
Commit 96002256 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

fix(annuaire): Fix case one job an no employer for user

parent 49fe50e8
No related branches found
No related tags found
3 merge requests!247V2.1.0,!242V2.0,!127V2.0
......@@ -60,19 +60,20 @@ export class UserRegistryService {
const employersNames: string[] = employersList.map((e) => e.name);
// For each filter list (job or employer), we'll filter the main user list in order to get only the user that have a job or employer contained in the filters array
// For this, we une findexIndex method on job/employer name
if (employersList?.length && jobList?.length) {
return users.filter(
(user) =>
jobNames.findIndex((n) => user.job.name === n) > -1 &&
employersNames.findIndex((n) => user.employer.name === n) > -1
jobNames.findIndex((n) => user.job?.name === n) > -1 &&
employersNames.findIndex((n) => user.employer?.name === n) > -1
);
}
if (employersList?.length) {
return users.filter((user) => employersNames.findIndex((n) => user.employer.name === n) > -1);
return users.filter((user) => employersNames.findIndex((n) => user.employer?.name === n) > -1);
}
if (jobList?.length) {
return users.filter((user) => jobNames.findIndex((n) => user.job.name === n) > -1);
return users.filter((user) => jobNames.findIndex((n) => user.job?.name === n) > -1);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment