fix: évolution en pourcent 0 quand evol=0

wip-related-pages
sebastien.arod@gmail.com 2024-06-06 22:44:38 +02:00
parent 4cbc2c15a7
commit 0d8aa0209a
1 changed files with 3 additions and 1 deletions

View File

@ -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 {