ulubionetacje

This commit is contained in:
Mateusz Gruszczyński
2026-07-13 14:34:32 +02:00
parent cb37390a29
commit 1b996c0543
6 changed files with 91 additions and 5 deletions
+4 -2
View File
@@ -172,9 +172,11 @@ def fuel():
if not favorites: favorites=sorted(stations,key=lambda x:(-x.station_count,x.company_name.lower()))[:10];favorite_scope="default"
favorites=sorted(favorites,key=lambda x:(-x.station_count,x.display_name.lower()))
favorite_ids={x.id for x in favorites}
top_stations=sorted((x for x in stations if x.id not in favorite_ids),key=lambda x:(-x.station_count,x.display_name.lower()))[:10]
proposed_ids=favorite_ids|{x.id for x in top_stations}
favorite_catalog=sorted(stations,key=lambda x:(-x.station_count,x.display_name.lower()))
other_stations=sorted((x for x in stations if x.id not in favorite_ids),key=lambda x:x.display_name.lower())
return render_template("fuel_form.html", vehicles=vehicles, stations=stations, favorite_stations=favorites, favorite_catalog=favorite_catalog, other_stations=other_stations, now=datetime.now().strftime("%Y-%m-%dT%H:%M"), restricted=bool(allowed), favorite_scope=favorite_scope, company=settings, fuel_cards=FuelCard.query.filter_by(active=True,company_id=settings.id).order_by(FuelCard.name).all())
other_stations=sorted((x for x in stations if x.id not in proposed_ids),key=lambda x:x.display_name.lower())
return render_template("fuel_form.html", vehicles=vehicles, stations=stations, favorite_stations=favorites, top_stations=top_stations, favorite_catalog=favorite_catalog, other_stations=other_stations, now=datetime.now().strftime("%Y-%m-%dT%H:%M"), restricted=bool(allowed), favorite_scope=favorite_scope, company=settings, fuel_cards=FuelCard.query.filter_by(active=True,company_id=settings.id).order_by(FuelCard.name).all())
@main.route("/api/orlen-price")
@login_required