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 = {
|
export type ELStatsActuelles = {
|
||||||
nbFamilleResistantes: number;
|
nbFamilleResistantes: number;
|
||||||
/** Includes Ancient resistants */
|
|
||||||
nbFamilleResistantesOrEx: number;
|
nbFamilleResistantesOrEx: number;
|
||||||
dureeResistanceMoyenne: number;
|
dureeResistanceMoyenne: number;
|
||||||
dureeResistanceMediane: number;
|
dureeResistanceMediane: number;
|
||||||
|
@ -19,6 +18,7 @@ export type ELPeriodStats = {
|
||||||
periodId: string;
|
periodId: string;
|
||||||
stats: {
|
stats: {
|
||||||
nbFamilleResistantes: ValueWithEvol;
|
nbFamilleResistantes: ValueWithEvol;
|
||||||
|
nbFamilleResistantesOrEx: ValueWithEvol;
|
||||||
dureeResistanceMoyenne: ValueWithEvol;
|
dureeResistanceMoyenne: ValueWithEvol;
|
||||||
dureeResistanceMediane: ValueWithEvol;
|
dureeResistanceMediane: ValueWithEvol;
|
||||||
nbFamillesMisesEnDemeure: ValueWithEvol;
|
nbFamillesMisesEnDemeure: ValueWithEvol;
|
||||||
|
|
|
@ -24,6 +24,11 @@ export function computeELPeriodStats(
|
||||||
isResistantOverPeriod(famille, period)
|
isResistantOverPeriod(famille, period)
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
|
const nbFamilleResistantesOrEx = familles.filter((famille) => {
|
||||||
|
const por = periodOfResistance(famille, periodEndOrNow);
|
||||||
|
return por !== null && por.start < periodEndOrNow;
|
||||||
|
}).length;
|
||||||
|
|
||||||
const dureesResistances = familles
|
const dureesResistances = familles
|
||||||
.map((famille) => dureeResistanceInDays(famille, periodEndOrNow))
|
.map((famille) => dureeResistanceInDays(famille, periodEndOrNow))
|
||||||
.filter(notNull);
|
.filter(notNull);
|
||||||
|
@ -58,6 +63,10 @@ export function computeELPeriodStats(
|
||||||
nbFamilleResistantes,
|
nbFamilleResistantes,
|
||||||
previousELPeriodStats?.nbFamilleResistantes.value
|
previousELPeriodStats?.nbFamilleResistantes.value
|
||||||
),
|
),
|
||||||
|
nbFamilleResistantesOrEx: valueWithEvol(
|
||||||
|
nbFamilleResistantesOrEx,
|
||||||
|
previousELPeriodStats?.nbFamilleResistantesOrEx.value
|
||||||
|
),
|
||||||
dureeResistanceMediane: valueWithEvol(
|
dureeResistanceMediane: valueWithEvol(
|
||||||
dureeResistanceMediane,
|
dureeResistanceMediane,
|
||||||
previousELPeriodStats?.dureeResistanceMediane.value
|
previousELPeriodStats?.dureeResistanceMediane.value
|
||||||
|
|
Loading…
Reference in New Issue