Skip to content

Change MaintenanceMetrics to match diagram fields #63

Description

@HamzahSaleh

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions