#5 Added ability to get a quick overview of all of the product stats on one page.

This commit is contained in:
2024-02-02 16:42:19 +00:00
parent d09d597905
commit 8f0e995471
3 changed files with 24 additions and 4 deletions

View File

@ -29,7 +29,7 @@ class StatsController(DatabaseController):
cursor = self._conn.execute(
"SELECT * FROM Views",
)
rows = cursor.fetchmany()
rows = cursor.fetchall()
if rows is None:
return None

View File

@ -15,20 +15,23 @@ blueprint = Blueprint("stats", __name__, url_prefix='/stats')
@blueprint.route('/')
def stats_index():
""" Main page to view all of the statistics for the site """
db = StatsController()
data = db.read()
return ""
return render_template("index.html", content="stats.html", data=data)
@blueprint.route('/product/<int:id>')
def view_product_stats(id: int):
""" Page to view statistics for a given product """
db = StatsController()
data = db.read_product(id)
return ""
return render_template("index.html", content="stats.html", data=data)
@blueprint.route('/user/<int:id>')
def view_user_stats(id: int):
""" Page to view statistics for a given user """
db = StatsController()
data = db.read_user(id)
return ""
return render_template("index.html", content="stats.html", data=data)