1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Cleaned up semesters and students views

This commit is contained in:
Mo 2021-04-27 14:08:15 +02:00
parent 07dec709f7
commit a5a63166b7
3 changed files with 2 additions and 65 deletions

View file

@ -19,8 +19,8 @@ def util_processor():
return items return items
def navbarItems(title): def navbarItems(title):
adminPages = ["Students", "Assistants", "Experiments", "Appointments", "Groups", "Users", "Semesters"] adminPages = ["Assistants", "Experiments", "Appointments", "Groups"]
assistantPages = ["Students", "Assistants", "Experiments", "Appointments", "Groups"] assistantPages = ["Assistants", "Experiments", "Appointments", "Groups"]
if current_user.is_authenticated: if current_user.is_authenticated:
roleNames = [role.name for role in current_user.roles] 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") @app.route("/assistants")
@roles_required("admin") @roles_required("admin")
def assistants(): def assistants():
@ -189,20 +159,6 @@ def deactivate_users():
return redirect(url_for("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"]) @app.route("/set_semester", methods=["GET"])
@auth_required() @auth_required()
def set_semester(): def set_semester():

View file

@ -1,7 +0,0 @@
{% set title = "Semesters" %}
{% extends "layout.html" %}
{% block content %}
{{table|safe}}
{% endblock content %}

View file

@ -1,12 +0,0 @@
{% set title = "Students" %}
{% extends "layout.html" %}
{% block content %}
{% for table in tables %}
<h2>{{tablesLabels[loop.index0]}}</h2>
{{table|safe}}
{% else %}
No parts in this semster yet!
{% endfor %}
{% endblock content %}