Commit graph

2 commits

Author SHA1 Message Date
kianiadee
a5380aece6 fix(schema): one device per fill in v_fuel_fills (LATERAL + LIMIT 1)
A plate can map to multiple tracksolid.devices rows (vehicle re-fitted with a
new tracker), so the plain LEFT JOIN fanned out and double-counted litres/spend
(3345 view rows for 1888 live records). LATERAL ... ORDER BY enabled_flag,
updated_at LIMIT 1 picks one device per fill. Applied to prod as migration 02;
01 updated so fresh installs are correct. Verified: 1888 rows, 1775 matched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 23:49:37 +03:00
kianiadee
9943932200 Initial fleetfuel: rustfs fuel bucket → DB → FleetOps Fuel Log
Self-contained ingestion module (mirrors fleettickets) for the WhatsApp
fuel-record feed in the rustfs `fuel` bucket:

- import_fuel.py — snapshot/changes/file modes, raw-jsonb upsert on id
- migrations/01_fuel_schema.sql — fuel schema, plate/fuel-type/department
  normalizers, trigger-derived columns, reporting.v_fuel_fills +
  v_fuel_efficiency, grafana_ro grants
- s3util.py / shared.py / run_migrations.py — rustfs client + DB helpers
- docs/plan.html — implementation plan

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 23:24:33 +03:00