Fix stats view
Toss unused FatDish model.
This commit is contained in:
parent
729dab2ba4
commit
d9685b00d9
2 changed files with 1 additions and 20 deletions
|
@ -48,21 +48,3 @@ class FatUser(User, FatModel):
|
|||
|
||||
class FatOrderItem(OrderItem, FatModel):
|
||||
pass
|
||||
|
||||
|
||||
class FatDish(Dish, FatModel):
|
||||
@classmethod
|
||||
def top4(cls) -> None:
|
||||
top4 = (
|
||||
OrderItem.query
|
||||
.join(Order)
|
||||
.group_by(Order.location_id, OrderItem.dish_id)
|
||||
.with_entities(
|
||||
Order.location_id, OrderItem.dish_id, func.count(
|
||||
OrderItem.dish_id).label("count")
|
||||
)
|
||||
.order_by(desc("count"))
|
||||
.limit(4)
|
||||
)
|
||||
for top in top4:
|
||||
print(top)
|
||||
|
|
|
@ -3,7 +3,7 @@ from flask import Blueprint
|
|||
from flask import current_app as app
|
||||
from flask import render_template
|
||||
|
||||
from fatmodels import FatLocation, FatOrder, FatOrderItem, FatDish, FatUser
|
||||
from fatmodels import FatLocation, FatOrder, FatOrderItem, FatUser
|
||||
|
||||
stats_blueprint = Blueprint("stats_blueprint", __name__)
|
||||
|
||||
|
@ -17,7 +17,6 @@ def stats() -> str:
|
|||
"locations": FatLocation.amount(),
|
||||
"users": FatUser.amount(),
|
||||
"orderitems": FatOrderItem.amount(),
|
||||
"products": FatDish.amount(),
|
||||
}
|
||||
}
|
||||
return render_template("stats.html", data=data)
|
||||
|
|
Loading…
Reference in a new issue