From 3ce7bd36b8d1aa6e21572239abd869e2209861ae Mon Sep 17 00:00:00 2001 From: Mike Johnston Date: Sat, 21 Mar 2026 23:45:49 -0400 Subject: [PATCH] this either fixes price charts or makes them backwards. lets see --- src/app/hashtag/[tag]/page.tsx | 5 +++-- src/app/positions/page.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/hashtag/[tag]/page.tsx b/src/app/hashtag/[tag]/page.tsx index 25433a3..11d946f 100644 --- a/src/app/hashtag/[tag]/page.tsx +++ b/src/app/hashtag/[tag]/page.tsx @@ -35,7 +35,8 @@ export default async function HashtagPage({ params, searchParams }: Props) { where: { tag }, include: { priceHistory: { - orderBy: { recordedAt: 'asc' }, + orderBy: { recordedAt: 'desc' }, + take: 192, // 192 updates = 2 days of 15-min intervals }, _count: { select: { positions: true }, @@ -153,7 +154,7 @@ export default async function HashtagPage({ params, searchParams }: Props) {

Price History

({ ...p, recordedAt: p.recordedAt.toISOString() }))} + data={hashtag.priceHistory.slice().reverse().map((p) => ({ ...p, recordedAt: p.recordedAt.toISOString() }))} height={280} />
diff --git a/src/app/positions/page.tsx b/src/app/positions/page.tsx index 5b5a8cf..9cc63fc 100644 --- a/src/app/positions/page.tsx +++ b/src/app/positions/page.tsx @@ -88,7 +88,7 @@ export default async function PositionsPage({ displayTag: true, currentPrice: true, priceHistory: { - orderBy: { recordedAt: 'asc' }, + orderBy: { recordedAt: 'desc' }, take: 20, select: { price: true }, }, @@ -148,7 +148,7 @@ export default async function PositionsPage({ const costBasis = pos.avgBuyPrice * pos.shares const currentValue = pos.hashtag.currentPrice * pos.shares const pnlPct = costBasis > 0 ? (pnl / costBasis) * 100 : 0 - const sparkPrices = pos.hashtag.priceHistory.map((h) => h.price) + const sparkPrices = pos.hashtag.priceHistory.slice().reverse().map((h) => h.price) return { ...pos, pnl, costBasis, currentValue, pnlPct, sparkPrices } })