fix: Vehicle summary screen does not display maintenance records (#239) #240
@@ -142,7 +142,9 @@ export const VehicleDetailMobile: React.FC<VehicleDetailMobileProps> = ({
|
|||||||
secondaryParts.push(new Date(rec.date).toLocaleDateString());
|
secondaryParts.push(new Date(rec.date).toLocaleDateString());
|
||||||
secondaryParts.push('Maintenance');
|
secondaryParts.push('Maintenance');
|
||||||
const secondary = secondaryParts.join(' • ');
|
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({
|
list.push({
|
||||||
id: rec.id,
|
id: rec.id,
|
||||||
type: 'Maintenance',
|
type: 'Maintenance',
|
||||||
|
|||||||
@@ -148,7 +148,9 @@ export const VehicleDetailPage: React.FC = () => {
|
|||||||
if (subtypeText) parts.push(subtypeText);
|
if (subtypeText) parts.push(subtypeText);
|
||||||
if (rec.shopName) parts.push(rec.shopName);
|
if (rec.shopName) parts.push(rec.shopName);
|
||||||
const summary = parts.join(' • ');
|
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 });
|
list.push({ id: rec.id, type: 'Maintenance', date: rec.date, summary, amount });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user