feat: ajoute Nb familles résistantes ou ex-résistantes sur la période
parent
5aa6974685
commit
af0fba621a
|
@ -6,7 +6,6 @@ export type ELStats = {
|
|||
};
|
||||
export type ELStatsActuelles = {
|
||||
nbFamilleResistantes: number;
|
||||
/** Includes Ancient resistants */
|
||||
nbFamilleResistantesOrEx: number;
|
||||
dureeResistanceMoyenne: number;
|
||||
dureeResistanceMediane: number;
|
||||
|
@ -19,6 +18,7 @@ export type ELPeriodStats = {
|
|||
periodId: string;
|
||||
stats: {
|
||||
nbFamilleResistantes: ValueWithEvol;
|
||||
nbFamilleResistantesOrEx: ValueWithEvol;
|
||||
dureeResistanceMoyenne: ValueWithEvol;
|
||||
dureeResistanceMediane: ValueWithEvol;
|
||||
nbFamillesMisesEnDemeure: ValueWithEvol;
|
||||
|
|
|
@ -24,6 +24,11 @@ export function computeELPeriodStats(
|
|||
isResistantOverPeriod(famille, period)
|
||||
).length;
|
||||
|
||||
const nbFamilleResistantesOrEx = familles.filter((famille) => {
|
||||
const por = periodOfResistance(famille, periodEndOrNow);
|
||||
return por !== null && por.start < periodEndOrNow;
|
||||
}).length;
|
||||
|
||||
const dureesResistances = familles
|
||||
.map((famille) => dureeResistanceInDays(famille, periodEndOrNow))
|
||||
.filter(notNull);
|
||||
|
@ -58,6 +63,10 @@ export function computeELPeriodStats(
|
|||
nbFamilleResistantes,
|
||||
previousELPeriodStats?.nbFamilleResistantes.value
|
||||
),
|
||||
nbFamilleResistantesOrEx: valueWithEvol(
|
||||
nbFamilleResistantesOrEx,
|
||||
previousELPeriodStats?.nbFamilleResistantesOrEx.value
|
||||
),
|
||||
dureeResistanceMediane: valueWithEvol(
|
||||
dureeResistanceMediane,
|
||||
previousELPeriodStats?.dureeResistanceMediane.value
|
||||
|
|
Loading…
Reference in New Issue