From 91691b743cf42edf73a7ea87bebea4280c911ed6 Mon Sep 17 00:00:00 2001 From: Olivier Ribiere Date: Fri, 15 Dec 2023 12:11:08 +0100 Subject: [PATCH] fix(stat): review nb operation count --- src/classes/PopUpAndStats.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/classes/PopUpAndStats.ts b/src/classes/PopUpAndStats.ts index 4051eec..9df36a2 100644 --- a/src/classes/PopUpAndStats.ts +++ b/src/classes/PopUpAndStats.ts @@ -55,7 +55,7 @@ export const updateStats = function (minDate: Date, maxDate: Date, timeFilteredD let under5 = 0 let nbNationalities = 0 const days = new Set() - const nbRescueOps = store.allData.filter(el => el.typeOps === "Rescue").length + const nbRescueOps = store.allData.map(x => x.nbOps).reduce((acc, currentVal) => acc + currentVal, 0) const nbPeopleAssisted = store.allData.filter(el => el.nbSurvivor).map( el => el.nbSurvivor).reduce((partialSum, a) => partialSum + a, 0) const nationalitiesList = [] @@ -68,7 +68,6 @@ export const updateStats = function (minDate: Date, maxDate: Date, timeFilteredD under18unacc = data.under18unacc ? under18unacc + data.under18unacc : under18unacc under5 = data.under5 ? under5 + data.under5 : under5 if (data.nbNationalities) nationalitiesList.push(data.nbNationalities.split(";")) - // nbNationalities = data.nbNationalities ? Math.max(nbNationalities, data.nbNationalities) : nbNationalities days.add(data.date) } nbNationalities = [...new Set(nationalitiesList.flat())].length