Properly rephrase
This commit is contained in:
parent
d7f35cf4bc
commit
4f76401446
1 changed files with 3 additions and 4 deletions
|
|
@ -207,8 +207,7 @@ class Pixel(meta.Base):
|
||||||
marker.add_to(self.grid.city.map)
|
marker.add_to(self.grid.city.map)
|
||||||
|
|
||||||
if restaurants:
|
if restaurants:
|
||||||
# Obtain all primary `Address`es in the city that host `Restaurant`s
|
# All primary `Address`es in the pixel that host `Restaurant`s
|
||||||
# and are in the `self` `Pixel`
|
|
||||||
addresses = db.session.scalars(
|
addresses = db.session.scalars(
|
||||||
sa.select(db.Address).where(
|
sa.select(db.Address).where(
|
||||||
db.Address.id.in_(
|
db.Address.id.in_(
|
||||||
|
|
@ -242,13 +241,13 @@ class Pixel(meta.Base):
|
||||||
tooltip = f"Restaurants {ids}"
|
tooltip = f"Restaurants {ids}"
|
||||||
|
|
||||||
if order_counts:
|
if order_counts:
|
||||||
# Calculate the number of orders for ALL restaurants ...
|
# Count the `Order`s of all `Restaurant`s at the `address` ...
|
||||||
n_orders = db.session.execute(
|
n_orders = db.session.execute(
|
||||||
sa.select(sa.func.count(db.Order.id))
|
sa.select(sa.func.count(db.Order.id))
|
||||||
.join(db.Address, db.Order.pickup_address_id == db.Address.id)
|
.join(db.Address, db.Order.pickup_address_id == db.Address.id)
|
||||||
.where(db.Address.primary_id == address.id),
|
.where(db.Address.primary_id == address.id),
|
||||||
).scalar_one()
|
).scalar_one()
|
||||||
# ... and adjust the size of the red dot on the `.map`
|
# ... and size the dot on the `.map` accordingly
|
||||||
if n_orders >= 1000:
|
if n_orders >= 1000:
|
||||||
radius = 20
|
radius = 20
|
||||||
elif n_orders >= 500:
|
elif n_orders >= 500:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue