Change MaintenanceMetrics to match diagram fields
Description
Expand maintenance_metrics so it stores the road-call and fuel/energy fields shown in the diagram.
Technical Details
Current schema only stores id, reporting_month, and created_at. The diagram expects maintenance metrics to be keyed by monthly_report_id.
Schema Changes
Change maintenance_metrics to include:
id SERIAL PRIMARY KEY
monthly_report_id INTEGER NOT NULL referencing monthly_department_report.id
motor_bus_major_road_calls INTEGER DEFAULT 0
motor_bus_other_road_calls INTEGER DEFAULT 0
lift_major_road_calls INTEGER DEFAULT 0
lift_other_road_calls INTEGER DEFAULT 0
bus_diesel_gallons INTEGER DEFAULT 0
bus_gasoline_gallons INTEGER DEFAULT 0
eb_kwh_charging INTEGER DEFAULT 0
eb_kwh_propulsion INTEGER DEFAULT 0
lift_diesel_gallons INTEGER DEFAULT 0
lift_gasoline_gallons INTEGER DEFAULT 0
Remove reporting_month.
Frontend Tasks
Update /api/maintenance and the maintenance page so all diagram fields are captured and saved.
Acceptance Criteria
- Maintenance submissions save all road-call and fuel/energy fields.
- Rows reference
monthly_report_id.
- The API no longer inserts a row containing only the report month.
Dependencies
Depends on MonthlyDepartmentReport.
Change MaintenanceMetrics to match diagram fields
Description
Expand
maintenance_metricsso it stores the road-call and fuel/energy fields shown in the diagram.Technical Details
Current schema only stores
id,reporting_month, andcreated_at. The diagram expects maintenance metrics to be keyed bymonthly_report_id.Schema Changes
Change
maintenance_metricsto include:id SERIAL PRIMARY KEYmonthly_report_id INTEGER NOT NULLreferencingmonthly_department_report.idmotor_bus_major_road_calls INTEGER DEFAULT 0motor_bus_other_road_calls INTEGER DEFAULT 0lift_major_road_calls INTEGER DEFAULT 0lift_other_road_calls INTEGER DEFAULT 0bus_diesel_gallons INTEGER DEFAULT 0bus_gasoline_gallons INTEGER DEFAULT 0eb_kwh_charging INTEGER DEFAULT 0eb_kwh_propulsion INTEGER DEFAULT 0lift_diesel_gallons INTEGER DEFAULT 0lift_gasoline_gallons INTEGER DEFAULT 0Remove
reporting_month.Frontend Tasks
Update
/api/maintenanceand the maintenance page so all diagram fields are captured and saved.Acceptance Criteria
monthly_report_id.Dependencies
Depends on
MonthlyDepartmentReport.