From 83c13d006f2a9be2ab8cbf4fd657f51627225267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Huchet?= Date: Mon, 28 Mar 2022 10:05:38 +0200 Subject: [PATCH] chore(app): remove useless selectors --- app/src/recoil/selectors.js | 61 ------------------------------------- 1 file changed, 61 deletions(-) diff --git a/app/src/recoil/selectors.js b/app/src/recoil/selectors.js index a1af5d31e..a6bdd5f9b 100644 --- a/app/src/recoil/selectors.js +++ b/app/src/recoil/selectors.js @@ -301,64 +301,3 @@ export const territoriesSearchSelector = selectorFamily({ return filterBySearch(search, territories); }, }); - -export const territoriesFullSearchSelector = selectorFamily({ - key: 'territoriesFullSearchSelector', - get: - ({ search = '' }) => - ({ get }) => { - const territories = get(territoriesState); - if (!search.length) return territories; - - const territoryObservations = get(onlyFilledObservationsTerritories); - - const territoriesIdsByTerritoriesSearch = filterBySearch(search, territories).map((t) => t._id); - const territoriesIdsFilteredByObsSearch = filterBySearch(search, territoryObservations).map((obs) => obs.territory); - - const territoriesIdsFilterBySearch = [...new Set([...territoriesIdsByTerritoriesSearch, ...territoriesIdsFilteredByObsSearch])]; - return territories.filter((t) => territoriesIdsFilterBySearch.includes(t._id)); - }, -}); - -export const passagesNonAnonymousPerDatePerTeamSelector = selectorFamily({ - key: 'passagesNonAnonymousPerDatePerTeamSelector', - get: - ({ date }) => - ({ get }) => { - const currentTeam = get(currentTeamState); - const comments = get(commentsState); - const persons = get(personsState); - return comments - .filter((c) => c.team === currentTeam._id) - .filter((c) => getIsDayWithinHoursOffsetOfDay(c.createdAt, date, currentTeam?.nightSession ? 12 : 0)) - .filter((c) => !!(c.comment || '').includes('Passage enregistré')) - .map((passage) => { - const commentPopulated = { ...passage }; - if (passage.person) { - commentPopulated.person = persons.find((p) => p._id === passage?.person); - commentPopulated.type = 'person'; - } - return commentPopulated; - }); - }, -}); - -export const numberOfPassagesNonAnonymousPerDatePerTeamSelector = selectorFamily({ - key: 'numberOfPassagesNonAnonymousPerDatePerTeamSelector', - get: - ({ date }) => - ({ get }) => { - const nonAnonymousPassages = get(passagesNonAnonymousPerDatePerTeamSelector({ date })); - return nonAnonymousPassages?.length || 0; - }, -}); - -export const numberOfPassagesAnonymousPerDatePerTeamSelector = selectorFamily({ - key: 'numberOfPassagesAnonymousPerDatePerTeamSelector', - get: - ({ date }) => - ({ get }) => { - const todaysReports = get(reportPerDateSelector({ date })); - return todaysReports?.passages || 0; - }, -});