bugfixing: price target

This commit is contained in:
MuslemRahimi 2024-11-04 20:08:28 +01:00
parent c213b48090
commit 8ead3b2473

View File

@ -42,8 +42,14 @@
: "-"; : "-";
consensusRating = analystRating?.consensusRating; consensusRating = analystRating?.consensusRating;
changesPercentage = changesPercentage =
analystRating?.priceTarget !== ("n/a" && 0) analystRating?.medianPriceTarget !== "n/a" &&
? ((priceTarget / data?.getStockQuote?.price - 1) * 100)?.toFixed(2) analystRating?.medianPriceTarget !== null &&
analystRating?.medianPriceTarget !== undefined &&
data?.getStockQuote?.price !== null
? (
(analystRating.medianPriceTarget / data.getStockQuote.price - 1) *
100
)?.toFixed(2)
: "-"; : "-";
} }
if (activeIdx === 1) { if (activeIdx === 1) {
@ -220,7 +226,9 @@
<div <div
class="mt-1 break-words font-semibold leading-8 text-white tiny:text-lg xs:text-xl sm:text-2xl" class="mt-1 break-words font-semibold leading-8 text-white tiny:text-lg xs:text-xl sm:text-2xl"
> >
${priceTarget} {priceTarget !== null && priceTarget !== undefined
? "$" + priceTarget
: "n/a"}
</div> </div>
</div> </div>
<div <div
@ -232,10 +240,12 @@
<div <div
class="mt-1 break-words font-semibold leading-8 tiny:text-lg xs:text-xl sm:text-2xl {changesPercentage >= class="mt-1 break-words font-semibold leading-8 tiny:text-lg xs:text-xl sm:text-2xl {changesPercentage >=
0 0
? "before:content-['+'] text-[#00FC50]" ? "before:content-['+'] after:content-['%'] text-[#00FC50]"
: 'text-[#FF2F1F]'}" : changesPercentage < 0
? "after:content-['%'] text-[#FF2F1F]"
: 'text-white'}"
> >
{changesPercentage}% {changesPercentage}
</div> </div>
</div> </div>
</div> </div>