fix: destructure cost before spread so convertCost isn't overwritten in models JSON output

This commit is contained in:
Travis Haley 2026-04-16 13:08:46 -06:00
parent 09139b1d92
commit fad21f3097

View file

@ -125,8 +125,7 @@ function buildJsonReport(projects: ProjectSummary[], period: string) {
}
const models = Object.entries(modelMap)
.sort(([, a], [, b]) => b.cost - a.cost)
.map(([name, d]) => ({ name, cost: convertCost(d.cost), ...d, cost_usd: undefined }))
.map(({ cost_usd: _, ...rest }) => rest)
.map(([name, { cost, ...rest }]) => ({ name, ...rest, cost: convertCost(cost) }))
// activities
const catMap: Record<string, { turns: number; cost: number; editTurns: number; oneShotTurns: number }> = {}