Make mypy work again #8
2 changed files with 8 additions and 8 deletions
Rename the restaurants list ...
... because it shadowed the `restaurants` parameter, a `bool`
commit
1c206a715b
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue