mirror of
https://framagit.org/enfance-libre/statistiques
synced 2025-12-07 07:23:44 +00:00
fix: évolution en pourcent 0 quand evol=0
This commit is contained in:
parent
4cbc2c15a7
commit
0d8aa0209a
1 changed files with 3 additions and 1 deletions
|
|
@ -78,7 +78,9 @@ function valueWithEvol(
|
|||
|
||||
function evolPercent(current: number, previous: number | undefined): number {
|
||||
if (previous === undefined) return NaN;
|
||||
return (100 * evol(current, previous)) / previous;
|
||||
const evolValue = evol(current, previous);
|
||||
if (evolValue === 0) return 0;
|
||||
return (100 * evolValue) / previous;
|
||||
}
|
||||
|
||||
function evol(current: number, previous: number | undefined): number {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue