Skip to content

Commit

Permalink
Add a NaN check
Browse files Browse the repository at this point in the history
  • Loading branch information
h0i5 committed Jul 26, 2024
1 parent 561749c commit 5e652ac
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/portfolio/sections/Networth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,20 @@ export default function Networth(props: any) {
) : (
<span className="red-text ">
{" "}
{parseInt(profitDetails?.overallProfit).toFixed(2)} (
{(
{parseInt(profitDetails?.overallProfit).toFixed(2)}(
{isNaN(
100 -
((data?.spentCash + profitDetails?.overallProfit) /
data?.spentCash) *
100
).toFixed(2)}
((parseInt(data?.spentCash) +
parseInt(profitDetails?.overallProfit)) /
parseInt(data?.spentCash)) *
100,
)
? 0
: 100 -
((parseInt(data?.spentCash) +
parseInt(profitDetails?.overallProfit)) /
parseInt(data?.spentCash)) *
100}
%)
</span>
)}
Expand Down

0 comments on commit 5e652ac

Please sign in to comment.