Return all fuel prices per station (E5/E10/DIESEL) so clients switch fuel tabs without refetch
This commit is contained in:
@@ -273,6 +273,13 @@ def stations(
|
||||
continue
|
||||
s_lat = station.get("latitude", station.get("lat"))
|
||||
s_lng = station.get("longitude", station.get("lng"))
|
||||
# All known fuel grades for this station (E5/E10/DIESEL) so clients can
|
||||
# switch fuel tabs without another request.
|
||||
prices = {}
|
||||
for grade in ("E5", "E10", "DIESEL"):
|
||||
p = _fuel_price(station, grade)
|
||||
if p is not None:
|
||||
prices[grade] = p
|
||||
item = {
|
||||
"id": station.get("id") or station.get("station_id"),
|
||||
"name": station.get("name") or station.get("station_name"),
|
||||
@@ -282,6 +289,7 @@ def stations(
|
||||
"lat": s_lat,
|
||||
"lng": s_lng,
|
||||
"price": price,
|
||||
"prices": prices,
|
||||
"price_updated": station.get("price_updated") or station.get("updated_at"),
|
||||
}
|
||||
if lat is not None and lng is not None and isinstance(s_lat, (int, float)) and isinstance(s_lng, (int, float)):
|
||||
|
||||
Reference in New Issue
Block a user