From d9685b00d98174e4d85a549dc59870d40d5e264b Mon Sep 17 00:00:00 2001 From: Midgard Date: Wed, 26 Feb 2020 21:33:41 +0100 Subject: [PATCH] Fix stats view Toss unused FatDish model. --- app/fatmodels.py | 18 ------------------ app/views/stats.py | 3 +-- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/app/fatmodels.py b/app/fatmodels.py index 2ab2f29..7757db1 100644 --- a/app/fatmodels.py +++ b/app/fatmodels.py @@ -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) diff --git a/app/views/stats.py b/app/views/stats.py index 7204db9..19ef0a2 100644 --- a/app/views/stats.py +++ b/app/views/stats.py @@ -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)