fix: coerce maintenance cost to number for amount column (refs #239)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 1m11s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 42s
Deploy to Staging / Verify Staging (pull_request) Successful in 4s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 3s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 1m11s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 42s
Deploy to Staging / Verify Staging (pull_request) Successful in 4s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 3s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
Postgres numeric columns come back as strings via node-postgres, so typeof rec.cost === 'number' was false and the amount column rendered as '—'. Coerce with Number() (matching the pattern in MaintenanceRecordsList) so the cost displays as a dollar amount. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user