diff --git a/src/spz/__init__.py b/src/spz/__init__.py index 50dd881..842ce56 100644 --- a/src/spz/__init__.py +++ b/src/spz/__init__.py @@ -198,9 +198,9 @@ def rlrc_comment(): ('/internal/administration/teacher//add', admin_views.add_teacher, ['GET', 'POST']), ('/internal/administration/teacher/edit/', admin_views.edit_teacher, ['GET', 'POST']), ('/internal/teacher/', admin_views.teacher, ['GET', 'POST']), - ('/internal/teacher//grades/', admin_views.grade, ['GET', 'POST']), - ('/internal/teacher//grades//edit', admin_views.edit_grade, ['GET', 'POST']), - ('/internal/teacher//grades//edit_view', admin_views.edit_grade_view, ['GET', 'POST']), + ('/internal/grades/', admin_views.grade, ['GET', 'POST']), + ('/internal/grades//edit', admin_views.edit_grade, ['GET', 'POST']), + ('/internal//grades//edit_view', admin_views.edit_grade_view, ['GET', 'POST']), ('/internal/teacher//attendance/', admin_views.attendances, ['GET', 'POST']), ('/internal/teacher//attendance//edit/', admin_views.edit_attendances, ['GET', 'POST']) diff --git a/src/spz/administration/admin_views.py b/src/spz/administration/admin_views.py index bd2e01f..4496dc7 100644 --- a/src/spz/administration/admin_views.py +++ b/src/spz/administration/admin_views.py @@ -197,18 +197,16 @@ def teacher(id): @templated('internal/administration/grade.html') -def grade(id, course_id): - teacher_db = models.User.query.get_or_404(id) +def grade(course_id): course = models.Course.query.get_or_404(course_id) exam_date = app.config['EXAM_DATE'] - return dict(teacher=teacher_db, course=course, exam_date=exam_date) + return dict(course=course, exam_date=exam_date) @templated('internal/administration/edit_grade.html') -def edit_grade(id, course_id): - teacher_db = models.User.query.get_or_404(id) +def edit_grade(course_id): course = models.Course.query.get_or_404(course_id) # !!! course.course_list returns only active applicants (not on waiting list) # populate grade fields with applicant parameters @@ -244,12 +242,11 @@ def edit_grade(id, course_id): return redirect(url_for('edit_grade_view', id=id, course_id=course_id)) - return dict(teacher=teacher_db, course=course, form=form, exam_date=exam_date) + return dict(course=course, form=form, exam_date=exam_date) @templated('internal/administration/edit_grade_view.html') -def edit_grade_view(id, course_id): - teacher_db = models.User.query.get_or_404(id) +def edit_grade_view(course_id): course = models.Course.query.get_or_404(course_id) exam_date = app.config['EXAM_DATE'] @@ -276,7 +273,7 @@ def edit_grade_view(id, course_id): return redirect(url_for('grade', id=id, course_id=course_id)) - return dict(teacher=teacher_db, course=course, exam_date=exam_date) + return dict(course=course, exam_date=exam_date) @templated('internal/administration/attendances.html') diff --git a/src/spz/models.py b/src/spz/models.py index d58b924..8748268 100644 --- a/src/spz/models.py +++ b/src/spz/models.py @@ -210,7 +210,7 @@ class Applicant(db.Model): is_student = db.Column(db.Boolean) # internal representation of the grade is in % - grade = db.Column(db.Integer) # TODO store grade encrypted + grade = db.Column(db.Integer, nullable=True) # TODO store grade encrypted ects_points = db.Column(db.Integer, nullable=True, default=0) # if a student only wants 'bestanden' instead of the grade value, is set to true hide_grade = db.Column(db.Boolean, nullable=False, default=False) @@ -251,6 +251,8 @@ def full_name(self): @property def full_grade(self): + if self.grade is None: + return "-" conversion_table = [ (98, 1), (95, 1.3), diff --git a/src/spz/templates/internal/administration/edit_grade.html b/src/spz/templates/internal/administration/edit_grade.html index d206165..63e2e2b 100644 --- a/src/spz/templates/internal/administration/edit_grade.html +++ b/src/spz/templates/internal/administration/edit_grade.html @@ -73,7 +73,7 @@

Schritt 1:

- + diff --git a/src/spz/templates/internal/administration/edit_grade_view.html b/src/spz/templates/internal/administration/edit_grade_view.html index bd56ca8..f4785ee 100644 --- a/src/spz/templates/internal/administration/edit_grade_view.html +++ b/src/spz/templates/internal/administration/edit_grade_view.html @@ -66,7 +66,7 @@

Schritt 2:

- + diff --git a/src/spz/templates/internal/administration/grade.html b/src/spz/templates/internal/administration/grade.html index da7ec78..af7de7d 100644 --- a/src/spz/templates/internal/administration/grade.html +++ b/src/spz/templates/internal/administration/grade.html @@ -9,7 +9,7 @@ {% block internal_body %} @@ -19,7 +19,7 @@

Notenübersicht

@@ -44,7 +44,7 @@

Notenübersicht

{{ applicant.last_name }} {{ applicant.ects_points }} - {% if applicant.grade %} + {% if applicant.grade is not none %} {% if applicant.hide_grade %} bestanden {% else %} diff --git a/src/spz/templates/internal/language.html b/src/spz/templates/internal/language.html index 524fb00..78f13c4 100644 --- a/src/spz/templates/internal/language.html +++ b/src/spz/templates/internal/language.html @@ -35,6 +35,7 @@ Kurs-L. Anw.-L. Daten + Note @@ -51,6 +52,8 @@ + + {% if sums.update({ @@ -75,6 +78,7 @@ + diff --git a/src/spz/templates/internal/teacher.html b/src/spz/templates/internal/teacher.html index 91c89d1..f748def 100644 --- a/src/spz/templates/internal/teacher.html +++ b/src/spz/templates/internal/teacher.html @@ -30,7 +30,7 @@

Meine Kurse

{{ course.count_attendances() }} / {{ course.limit }} - +