Skip to content

feat(fuel): label the map with the compared grade's price and its age - #736

Merged
Medformatik merged 1 commit into
mainfrom
claude/confident-volta-2tlyvq
Nov 1, 2026
Merged

Medformatik merged 1 commit into
mainfrom
claude/confident-volta-2tlyvq

Conversation

@Medformatik

@Medformatik Medformatik commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

Fuel labels on the map at close zoom listed every grade a station prices (D €1.559 · E5 €1.699 · E10 €1.639), so neighbouring stations couldn't be compared at a glance. They now show only the grade the result list sorts by, which is the first selected fuel type or diesel when none is selected, plus how long ago that price was reported:

  • D €1.559 · 25 min, E10 €1.639 · 3 h, D €1.589 · 2 d (German: Min., Std., Tg.)
  • The price is the one the list sorts by: the cheapest self-service or standard car price per litre in the station's currency. Served-pump, HGV-only and per-kg prices aren't used.
  • A station without that price shows the grade as missing (E10 –) instead of another grade's price.
  • A price without a report time leaves the age out.

How it works: fuel results carry a new optional labelSummary on DataSourceResult. The search builds it for the comparison grade, and the map label uses it when a result has one, falling back to summary otherwise. The summary-label credits name the field actually shown. The result card in the list still shows every grade.

The age is computed when the search is answered, so it can be up to the search cache's two minutes behind. Stations near a border are compared in their own currencies, as the list sort already does.

Related work

Fixes #414

Verification

  • npx vitest run integrations/fuel apps/web/src/components/map/layers/DataSourceLayer.test.tsx: 68 passed. New tests cover:
    • the label grade and price in en and de
    • the default to diesel matching the list's sort rule
    • the label using the same price as sortValues
    • a missing price for the grade
    • the age switching from minutes to hours to days
    • no age when the report time is missing
    • the map label preferring labelSummary and crediting that field
  • tsc --noEmit passes in packages/core, apps/api (which includes the fuel integration) and apps/web.
  • npx biome check and pnpm check-translations pass.
  • I didn't check the change in a browser against a live fuel provider.

Release and upgrade impact

No package release: DataSourceResult.labelSummary is a type-only addition. I built @openmapx/extension-cli with pnpm build from main and from this branch, and its dist output (cli.js plus two chunks) is identical once content-hashed chunk names and absolute module-path comments are normalized.

Map labels at close zoom showed every grade a station prices, so neighbouring
stations could not be compared at a glance. A fuel result now carries a
labelSummary with only the grade the list sorts by (the first selected grade,
else diesel): its cheapest self-service car price per litre and how long ago
it was reported. A station without that price shows the grade as missing.
The map uses labelSummary when a result has one and credits that field.

Closes #414
@Medformatik
Medformatik merged commit 9275028 into main Nov 1, 2026
29 of 44 checks passed
@Medformatik
Medformatik deleted the claude/confident-volta-2tlyvq branch November 1, 2026 18:44
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show the selected fuel grade's price on map labels

1 participant