From fdd8ecaf3ec5686ee6ca2b67f4c29567cac93574 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 17 Sep 2024 10:56:27 +0200 Subject: [PATCH] analyst estimate bug fixing --- src/lib/components/AnalystEstimate.svelte | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/components/AnalystEstimate.svelte b/src/lib/components/AnalystEstimate.svelte index 9f560119..52d4c035 100644 --- a/src/lib/components/AnalystEstimate.svelte +++ b/src/lib/components/AnalystEstimate.svelte @@ -24,7 +24,7 @@ function findIndex(data) { const currentYear = new Date().getFullYear(); - return data.findIndex((item) => item.date >= currentYear && item.revenue === null); + return data.findIndex((item) => item.date > currentYear && item.revenue === null); } function changeStatement(event) { @@ -63,8 +63,8 @@ if (filteredData) { filteredData.forEach((item, index) => { const date = item.date?.toString().slice(-2); - const isBeforeStopIndex = index < stopIndex - 1; - const isAfterStartIndex = index >= stopIndex - 2; + const isBeforeStopIndex = index < stopIndex; + const isAfterStartIndex = index >= stopIndex -2; dates.push(`FY${date}`); switch (displayData) { case "Revenue": @@ -97,6 +97,7 @@ } }); } + try { const lastValue = valueList[stopIndex - 2]; avgList[stopIndex - 2] = lastValue;