fix: Vehicle summary screen does not display maintenance records (#239) #240

Merged
egullickson merged 2 commits from issue-239-vehicle-summary-maintenance into main 2026-05-16 01:56:11 +00:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit 55b8b67a6e - Show all commits

View File

@@ -142,7 +142,9 @@ export const VehicleDetailMobile: React.FC<VehicleDetailMobileProps> = ({
secondaryParts.push(new Date(rec.date).toLocaleDateString());
secondaryParts.push('Maintenance');
const secondary = secondaryParts.join(' • ');
const amount = typeof rec.cost === 'number' ? `$${rec.cost.toFixed(2)}` : undefined;
// Backend returns numeric/decimal columns as strings via node-postgres; coerce.
const costNum = rec.cost != null ? Number(rec.cost) : NaN;
const amount = Number.isFinite(costNum) ? `$${costNum.toFixed(2)}` : undefined;
list.push({
id: rec.id,
type: 'Maintenance',

View File

@@ -148,7 +148,9 @@ export const VehicleDetailPage: React.FC = () => {
if (subtypeText) parts.push(subtypeText);
if (rec.shopName) parts.push(rec.shopName);
const summary = parts.join(' • ');
const amount = typeof rec.cost === 'number' ? `$${rec.cost.toFixed(2)}` : undefined;
// Backend returns numeric/decimal columns as strings via node-postgres; coerce.
const costNum = rec.cost != null ? Number(rec.cost) : NaN;
const amount = Number.isFinite(costNum) ? `$${costNum.toFixed(2)}` : undefined;
list.push({ id: rec.id, type: 'Maintenance', date: rec.date, summary, amount });
}
}