this either fixes price charts or makes them backwards. lets see
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m23s

This commit is contained in:
2026-03-21 23:45:49 -04:00
parent 8fd5484e86
commit 3ce7bd36b8
2 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -35,7 +35,8 @@ export default async function HashtagPage({ params, searchParams }: Props) {
where: { tag }, where: { tag },
include: { include: {
priceHistory: { priceHistory: {
orderBy: { recordedAt: 'asc' }, orderBy: { recordedAt: 'desc' },
take: 192, // 192 updates = 2 days of 15-min intervals
}, },
_count: { _count: {
select: { positions: true }, select: { positions: true },
@@ -153,7 +154,7 @@ export default async function HashtagPage({ params, searchParams }: Props) {
<div className="bg-surface-card border border-surface-border rounded-xl p-4"> <div className="bg-surface-card border border-surface-border rounded-xl p-4">
<h2 className="text-sm font-medium text-slate-400 mb-4">Price History</h2> <h2 className="text-sm font-medium text-slate-400 mb-4">Price History</h2>
<PriceChart <PriceChart
data={hashtag.priceHistory.map((p) => ({ ...p, recordedAt: p.recordedAt.toISOString() }))} data={hashtag.priceHistory.slice().reverse().map((p) => ({ ...p, recordedAt: p.recordedAt.toISOString() }))}
height={280} height={280}
/> />
</div> </div>
+2 -2
View File
@@ -88,7 +88,7 @@ export default async function PositionsPage({
displayTag: true, displayTag: true,
currentPrice: true, currentPrice: true,
priceHistory: { priceHistory: {
orderBy: { recordedAt: 'asc' }, orderBy: { recordedAt: 'desc' },
take: 20, take: 20,
select: { price: true }, select: { price: true },
}, },
@@ -148,7 +148,7 @@ export default async function PositionsPage({
const costBasis = pos.avgBuyPrice * pos.shares const costBasis = pos.avgBuyPrice * pos.shares
const currentValue = pos.hashtag.currentPrice * pos.shares const currentValue = pos.hashtag.currentPrice * pos.shares
const pnlPct = costBasis > 0 ? (pnl / costBasis) * 100 : 0 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 } return { ...pos, pnl, costBasis, currentValue, pnlPct, sparkPrices }
}) })