From a5a63166b7469471b01a7e07c686ea461133b99a Mon Sep 17 00:00:00 2001 From: Mo8it Date: Tue, 27 Apr 2021 14:08:15 +0200 Subject: [PATCH] Cleaned up semesters and students views --- advlabdb/routes.py | 48 ++----------------------------- advlabdb/templates/semesters.html | 7 ----- advlabdb/templates/students.html | 12 -------- 3 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 advlabdb/templates/semesters.html delete mode 100644 advlabdb/templates/students.html diff --git a/advlabdb/routes.py b/advlabdb/routes.py index d49650b..be85551 100644 --- a/advlabdb/routes.py +++ b/advlabdb/routes.py @@ -19,8 +19,8 @@ def util_processor(): return items def navbarItems(title): - adminPages = ["Students", "Assistants", "Experiments", "Appointments", "Groups", "Users", "Semesters"] - assistantPages = ["Students", "Assistants", "Experiments", "Appointments", "Groups"] + adminPages = ["Assistants", "Experiments", "Appointments", "Groups"] + assistantPages = ["Assistants", "Experiments", "Appointments", "Groups"] if current_user.is_authenticated: roleNames = [role.name for role in current_user.roles] @@ -60,36 +60,6 @@ def index(): ) -@app.route("/students") -@roles_required("admin") -def students(): - semester = Semester.query.get(current_user.active_semester_id) - parts = semester.parts - tables = [] - tablesLabels = [] - - headerAndDataList = [["Student number", "row.student.student_number"], - ["First name", "row.student.first_name"], - ["Last name", "row.student.last_name"], - ["Email", "row.student.email"], - ["GN", "row.group.number"], - ["Bachelor thesis", "row.student.bachelor_thesis"], - ["BT WG", "row.student.bachelor_thesis_work_group"], - ["Note", "row.student.note"], - ["Final part mark", "row.final_part_mark"], - ["Experiemt marks", "row.experiment_marks"], - ["Parts", "[ps.part for ps in row.student.part_students]"]] - - for part in parts: - tablesLabels.append("Part " + part.label + ":") - tables.append(makeTable(headerAndDataList=headerAndDataList, - rows=part.part_students)) - return render_template("students.html", - tables=tables, - tablesLabels=tablesLabels, - ) - - @app.route("/assistants") @roles_required("admin") def assistants(): @@ -189,20 +159,6 @@ def deactivate_users(): return redirect(url_for("users")) -@app.route("/semesters") -@roles_required("admin") -def semesters(): - headerAndDataList = [["Label", "row.label"], - ["Parts", "row.parts"]] - - table = makeTable(headerAndDataList=headerAndDataList, - rows=Semester.query.all()) - - return render_template("semesters.html", - table=table, - ) - - @app.route("/set_semester", methods=["GET"]) @auth_required() def set_semester(): diff --git a/advlabdb/templates/semesters.html b/advlabdb/templates/semesters.html deleted file mode 100644 index adfa80a..0000000 --- a/advlabdb/templates/semesters.html +++ /dev/null @@ -1,7 +0,0 @@ -{% set title = "Semesters" %} -{% extends "layout.html" %} -{% block content %} - -{{table|safe}} - -{% endblock content %} diff --git a/advlabdb/templates/students.html b/advlabdb/templates/students.html deleted file mode 100644 index 4fb04d3..0000000 --- a/advlabdb/templates/students.html +++ /dev/null @@ -1,12 +0,0 @@ -{% set title = "Students" %} -{% extends "layout.html" %} -{% block content %} - -{% for table in tables %} -

{{tablesLabels[loop.index0]}}

-{{table|safe}} -{% else %} -No parts in this semster yet! -{% endfor %} - -{% endblock content %}