diff --git a/flaskr/templates/cups.html b/flaskr/templates/cups.html
index 2bf68b5..fea447f 100644
--- a/flaskr/templates/cups.html
+++ b/flaskr/templates/cups.html
@@ -8,6 +8,8 @@ table, tr, td {
}
+
There is {{count}} cups
+
{% if cups_exist %}
diff --git a/flaskr/utils/cups.py b/flaskr/utils/cups.py
index 734bf56..2f26245 100644
--- a/flaskr/utils/cups.py
+++ b/flaskr/utils/cups.py
@@ -4,7 +4,9 @@ from flaskr.database import db
def query_cups():
sql = "SELECT name, id FROM cups"
result = db.session.execute(sql).fetchall()
- return result
+ sql = "SELECT count(cups.id) FROM cups"
+ count = db.session.execute(sql).fetchone()
+ return result, count[0]
def query_cup_by_name(cup_name: str):
diff --git a/flaskr/views/cups.py b/flaskr/views/cups.py
index f74270f..034b236 100644
--- a/flaskr/views/cups.py
+++ b/flaskr/views/cups.py
@@ -10,10 +10,10 @@ from flaskr.utils.cups import (
@app.route("/cups")
def get_cups():
- cups = query_cups()
+ cups, count = query_cups()
if cups is None:
- return render_template("cups.html", cups_exist=False)
- return render_template("cups.html", cups=cups, cups_exist=True)
+ return render_template("cups.html", cups_exist=False, count=count)
+ return render_template("cups.html", cups=cups, cups_exist=True, count=count)
@app.route("/cups/")