haldis/app/views/stats.py
Jan-Pieter Baert 5e29f2a5f7
Fix formatting
2022-04-19 22:04:49 +02:00

21 lines
652 B
Python

"Script to generate the stats related views of Haldis"
from fatmodels import FatLocation, FatOrder, FatOrderItem, FatUser
from flask import Blueprint
from flask import current_app as app
from flask import render_template
stats_blueprint = Blueprint("stats_blueprint", __name__)
@stats_blueprint.route("/")
def stats() -> str:
"Generate Haldis data in a pretty format"
data = {
"amount": {
"orders": FatOrder.amount(),
"locations": FatLocation.amount(),
"users": FatUser.amount(),
"orderitems": FatOrderItem.amount(),
}
}
return render_template("stats.html", data=data)