Skip to content

v0.13.0 — Per-vehicle odometer units & price history fix#80

Merged
dannymcc merged 3 commits intomainfrom
dev
Feb 19, 2026
Merged

v0.13.0 — Per-vehicle odometer units & price history fix#80
dannymcc merged 3 commits intomainfrom
dev

Conversation

@dannymcc
Copy link
Copy Markdown
Owner

Summary

Changes

Bug Fix — Price History 500 Error (Issue #78)

  • Fuel station price history page crashed because FuelPriceHistory ORM objects were passed to Jinja2's tojson filter
  • Added serializable dict list (prices_json) for Chart.js while keeping ORM objects for HTML table rendering

New Feature — Per-Vehicle Odometer Units (Issue #79)

  • Added odometer_unit column to Vehicle model (km, mi, or None to inherit user default)
  • Added get_effective_odometer_unit() method with fallback to user's global preference
  • Updated vehicle create/edit forms with unit selector
  • Updated fuel log forms, vehicle detail pages, and API stats to use vehicle-specific units
  • Includes database migration; fully backward compatible

Test plan

  • Verify fuel station price history page loads without error
  • Create/edit vehicles and set per-vehicle odometer units
  • Confirm existing vehicles without explicit unit fall back to user preference
  • Check fuel log forms show correct unit labels per vehicle

Adds an `odometer_unit` field to the Vehicle model, allowing users to
configure miles or km independently per vehicle. This is useful when
managing vehicles with different odometer units (e.g. a UK car in miles
and a foreign import or motorbike in km).

- Add `odometer_unit` column to vehicles table (nullable, defaults to user pref)
- Add `ODOMETER_UNITS` constant list and `get_effective_odometer_unit()` helper
- Add odometer unit selector to vehicle create/edit form
- Update fuel log list, fuel forms, and vehicle view to display the
  vehicle's effective unit rather than the global user preference
- Update Tessie odometer/range display to respect per-vehicle unit
- Create Alembic migration for the new column
Convert FuelPriceHistory ORM objects to serializable dicts before
passing to the template's tojson filter for Chart.js rendering.
@dannymcc dannymcc merged commit 3f28298 into main Feb 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant