Skip to content

Fix cheapest fuel not showing for shared station users#76

Merged
dannymcc merged 1 commit intomainfrom
dev
Feb 19, 2026
Merged

Fix cheapest fuel not showing for shared station users#76
dannymcc merged 1 commit intomainfrom
dev

Conversation

@dannymcc
Copy link
Copy Markdown
Owner

Summary

  • Fixes fuel price history not being recorded when logging fuel at shared stations (station owned by another user)
  • Fixes dashboard "Cheapest Fuel" section showing empty for users who don't own the stations
  • Fixes "View All" cheapest fuel page showing "No price data available" despite fuel being logged

Root Cause

When fuel stations were made system-wide in #57, two places still had user-scoped checks:

  1. app/routes/fuel.py:104 — Price history was only saved when station.user_id == current_user.id, so shared station users never had prices recorded
  2. app/routes/main.py:113 — Dashboard query filtered FuelPriceHistory.user_id == current_user.id, hiding prices recorded by other users

Changes

  • Removed ownership check in fuel logging — price history is now saved for any valid station
  • Removed user_id filter from dashboard cheapest fuel query — all price data is now visible

Fixes #75

Test plan

  • Log fuel at a station created by another user — verify price history is recorded
  • Check dashboard "Cheapest Fuel" section shows data for shared station prices
  • Click "View All" — verify prices appear for all stations
  • Verify existing single-user setups still work correctly

Remove user_id ownership check when saving fuel price history, allowing
price records to be created for any station (not just user-owned ones).
Remove user_id filter from dashboard cheapest fuel query so all price
data is visible regardless of which user recorded it.

Fixes #75
@dannymcc dannymcc merged commit 25c563f 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.

Cheapest fuel doesn't show

1 participant