Commit graph

1 commit

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