Explain the "why"
This commit is contained in:
parent
ab6b34b778
commit
f025923d25
1 changed files with 2 additions and 2 deletions
|
|
@ -185,13 +185,13 @@ class City(meta.Base):
|
||||||
)
|
)
|
||||||
|
|
||||||
if order_counts:
|
if order_counts:
|
||||||
# Calculate the number of orders for ALL restaurants ...
|
# Several restaurants may share an address
|
||||||
|
# => Count the orders of all of them
|
||||||
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`
|
|
||||||
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