From 1c206a715bf66996d1d3288439c0d07fbe56b1e3 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Mon, 30 Nov 2026 12:33:09 +0100 Subject: [PATCH] Rename the `restaurants` list ... ... because it shadowed the `restaurants` parameter, a `bool` --- src/velofy/db/customers.py | 8 ++++---- src/velofy/db/pixels.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/velofy/db/customers.py b/src/velofy/db/customers.py index da701f5..aa400d2 100644 --- a/src/velofy/db/customers.py +++ b/src/velofy/db/customers.py @@ -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: diff --git a/src/velofy/db/pixels.py b/src/velofy/db/pixels.py index 1d0f791..96cf050 100644 --- a/src/velofy/db/pixels.py +++ b/src/velofy/db/pixels.py @@ -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: