diff --git a/src/lib/components/AnalystCard.svelte b/src/lib/components/AnalystCard.svelte index 2f23ed08..7a8598b5 100644 --- a/src/lib/components/AnalystCard.svelte +++ b/src/lib/components/AnalystCard.svelte @@ -15,16 +15,25 @@ let changesPercentage = 0; $: { - if ($stockTicker && typeof window !== "undefined" && typeof analystRating !== "undefined" && Object?.keys(analystRating)?.length !== 0) { + if ( + $stockTicker && + typeof window !== "undefined" && + typeof analystRating !== "undefined" && + Object?.keys(analystRating)?.length !== 0 + ) { numOfAnalyst = analystRating?.numOfAnalyst; buyCount = ((analystRating?.Buy / numOfAnalyst) * 100)?.toFixed(2); holdCount = ((analystRating?.Hold / numOfAnalyst) * 100)?.toFixed(2); sellCount = ((analystRating?.Sell / numOfAnalyst) * 100)?.toFixed(2); - priceTarget = analystRating?.priceTarget !== ('n/a' && 0) ? analystRating?.priceTarget : '-'; + priceTarget = + analystRating?.priceTarget !== ("n/a" && 0) + ? analystRating?.priceTarget + : "-"; consensusRating = analystRating?.consensusRating; try { - changesPercentage = ((priceTarget / lastPrice - 1) * 100)?.toFixed(2) ?? 0; + changesPercentage = + ((priceTarget / lastPrice - 1) * 100)?.toFixed(2) ?? 0; } catch (e) { changesPercentage = 0; } @@ -33,28 +42,52 @@ -