Rename the restaurants list ...

... because it shadowed the `restaurants` parameter, a `bool`
This commit is contained in:
Alexander Hess 2026-11-30 12:33:09 +01:00
commit 1c206a715b
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
2 changed files with 8 additions and 8 deletions

View file

@ -137,17 +137,17 @@ class Customer(meta.Base):
# Show the restaurant's name if there is only one.
# Otherwise, list all the restaurants' ID's.
# We cannot show the `Order.restaurant.name` due to the aggregation.
restaurants = (
restaurants_at_address = (
db.session.query(db.Restaurant)
.join(db.Address, db.Restaurant.address_id == db.Address.id)
.filter(db.Address.primary_id == address.id)
.all()
)
if len(restaurants) == 1: # type:ignore
restaurant = restaurants[0] # type:ignore
if len(restaurants_at_address) == 1:
restaurant = restaurants_at_address[0]
tooltip = f"{restaurant.name} (#{restaurant.id})"
else:
ids = ", ".join(f"#{r.id}" for r in restaurants) # type:ignore
ids = ", ".join(f"#{r.id}" for r in restaurants_at_address)
tooltip = f"Restaurants {ids}"
if order_counts:

View file

@ -224,17 +224,17 @@ class Pixel(meta.Base):
for address in addresses:
# Show the restaurant's name if there is only one.
# Otherwise, list all the restaurants' ID's.
restaurants = (
restaurants_at_address = (
db.session.query(db.Restaurant)
.join(db.Address, db.Restaurant.address_id == db.Address.id)
.filter(db.Address.primary_id == address.id)
.all()
)
if len(restaurants) == 1: # type:ignore
restaurant = restaurants[0] # type:ignore
if len(restaurants_at_address) == 1:
restaurant = restaurants_at_address[0]
tooltip = f"{restaurant.name} (#{restaurant.id})"
else:
ids = ", ".join(f"#{r.id}" for r in restaurants) # type:ignore
ids = ", ".join(f"#{r.id}" for r in restaurants_at_address)
tooltip = f"Restaurants {ids}"
if order_counts: