rework vehicle handling
This commit is contained in:
@@ -373,16 +373,16 @@ class VehicleService {
|
||||
WHERE deleted_at IS NULL
|
||||
`);
|
||||
|
||||
const totals = totalsResult.rows[0];
|
||||
const alerts = alertResult.rows[0];
|
||||
const totals = totalsResult.rows[0] ?? { total: '0', einsatzbereit: '0', ausser_dienst: '0', in_lehrgang: '0' };
|
||||
const alerts = alertResult.rows[0] ?? { inspections_due: '0', inspections_overdue: '0' };
|
||||
|
||||
return {
|
||||
total: parseInt(totals.total, 10),
|
||||
einsatzbereit: parseInt(totals.einsatzbereit, 10),
|
||||
ausserDienst: parseInt(totals.ausser_dienst, 10),
|
||||
inLehrgang: parseInt(totals.in_lehrgang, 10),
|
||||
inspectionsDue: parseInt(alerts.inspections_due, 10),
|
||||
inspectionsOverdue: parseInt(alerts.inspections_overdue, 10),
|
||||
total: parseInt(totals.total ?? '0', 10),
|
||||
einsatzbereit: parseInt(totals.einsatzbereit ?? '0', 10),
|
||||
ausserDienst: parseInt(totals.ausser_dienst ?? '0', 10),
|
||||
inLehrgang: parseInt(totals.in_lehrgang ?? '0', 10),
|
||||
inspectionsDue: parseInt(alerts.inspections_due ?? '0', 10),
|
||||
inspectionsOverdue: parseInt(alerts.inspections_overdue ?? '0', 10),
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error('VehicleService.getVehicleStats failed', { error });
|
||||
|
||||
Reference in New Issue
Block a user