2019-08-28 03:46:04 +02:00
|
|
|
from flask import Blueprint
|
|
|
|
from flask import current_app as app
|
2016-09-10 15:49:52 +02:00
|
|
|
from flask import render_template
|
|
|
|
|
2019-08-28 03:46:04 +02:00
|
|
|
from fatmodels import FatLocation, FatOrder, FatOrderItem, FatProduct, FatUser
|
2016-09-10 16:52:46 +02:00
|
|
|
|
2019-09-05 03:33:29 +02:00
|
|
|
stats_blueprint = Blueprint("stats_blueprint", __name__)
|
2016-09-10 15:49:52 +02:00
|
|
|
|
2019-08-28 03:46:04 +02:00
|
|
|
|
2019-09-05 03:33:29 +02:00
|
|
|
@stats_blueprint.route("/")
|
2019-09-08 01:34:16 +02:00
|
|
|
def stats() -> str:
|
2016-09-10 16:52:46 +02:00
|
|
|
data = {
|
2019-09-05 03:33:29 +02:00
|
|
|
"amount": {
|
|
|
|
"orders": FatOrder.amount(),
|
|
|
|
"locations": FatLocation.amount(),
|
|
|
|
"users": FatUser.amount(),
|
|
|
|
"orderitems": FatOrderItem.amount(),
|
|
|
|
"products": FatProduct.amount(),
|
2016-09-10 23:01:13 +02:00
|
|
|
}
|
2016-09-10 16:52:46 +02:00
|
|
|
}
|
2019-09-05 03:33:29 +02:00
|
|
|
return render_template("stats.html", data=data)
|