Skip to content

Commit

Permalink
integrate edit grade flow into language table of courses as own column
Browse files Browse the repository at this point in the history
  • Loading branch information
urvdp committed Apr 21, 2024
1 parent a1f8d5d commit 8740b3e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/spz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def rlrc_comment():
('/internal/administration/teacher/<int:id>/add', admin_views.add_teacher, ['GET', 'POST']),
('/internal/administration/teacher/edit/<int:id>', admin_views.edit_teacher, ['GET', 'POST']),
('/internal/teacher/<int:id>', admin_views.teacher, ['GET', 'POST']),
('/internal/teacher/<int:id>/grades/<int:course_id>', admin_views.grade, ['GET', 'POST']),
('/internal/teacher/<int:id>/grades/<int:course_id>/edit', admin_views.edit_grade, ['GET', 'POST']),
('/internal/teacher/<int:id>/grades/<int:course_id>/edit_view', admin_views.edit_grade_view, ['GET', 'POST']),
('/internal/grades/<int:course_id>', admin_views.grade, ['GET', 'POST']),
('/internal/grades/<int:course_id>/edit', admin_views.edit_grade, ['GET', 'POST']),
('/internal//grades/<int:course_id>/edit_view', admin_views.edit_grade_view, ['GET', 'POST']),
('/internal/teacher/<int:id>/attendance/<int:course_id>', admin_views.attendances, ['GET', 'POST']),
('/internal/teacher/<int:id>/attendance/<int:course_id>/edit/<int:class_id>', admin_views.edit_attendances, ['GET', 'POST'])

Expand Down
15 changes: 6 additions & 9 deletions src/spz/administration/admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']

Expand All @@ -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')
Expand Down
4 changes: 3 additions & 1 deletion src/spz/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/spz/templates/internal/administration/edit_grade.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3>Schritt 1:</h3>
</div>
<div class="ui section divider"></div>
<div class="row">
<a href="{{ url_for('grade', id=teacher.id, course_id=course.id) }}">
<a href="{{ url_for('grade', course_id=course.id) }}">
<button type="button" class="ui button">Zurück</button>
</a>
<button type="submit" class="ui primary button confirm">Speichern und Weiter</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h3>Schritt 2:</h3>
</div>
<div class="ui section divider"></div>
<div class="row">
<a href="{{ url_for('edit_grade', id=teacher.id, course_id=course.id) }}">
<a href="{{ url_for('edit_grade', course_id=course.id) }}">
<button type="button" class="ui button">Zurück</button>
</a>
<button type="submit" class="ui primary button confirm">Speichern</button>
Expand Down
6 changes: 3 additions & 3 deletions src/spz/templates/internal/administration/grade.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block internal_body %}
<div>
<a href=" {{ url_for('teacher', id=teacher.id) }} ">
<a href=" {{ url_for('teacher', id=current_user.id) }} ">
<button type="button" class="ui button">Zurück zu meinen Kursen</button>
</a>
</div>
Expand All @@ -19,7 +19,7 @@
<h2>Notenübersicht</h2>
</div>
<div class="right floated column">
<a href=" {{ url_for('edit_grade', id=teacher.id, course_id=course.id) }} ">
<a href=" {{ url_for('edit_grade', course_id=course.id) }} ">
<button type="button" class="ui button"><i class="edit icon"></i>Noten ändern</button>
</a>
</div>
Expand All @@ -44,7 +44,7 @@ <h2>Notenübersicht</h2>
<td>{{ applicant.last_name }}</td>
<td>{{ applicant.ects_points }}</td>
<td>
{% if applicant.grade %}
{% if applicant.grade is not none %}
{% if applicant.hide_grade %}
<b>bestanden</b>
{% else %}
Expand Down
4 changes: 4 additions & 0 deletions src/spz/templates/internal/language.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<th class="collapsing">Kurs-L.</th>
<th class="collapsing">Anw.-L.</th>
<th class="collapsing">Daten</th>
<th class="collapsing">Note</th>
</tr>
</thead>
<tbody>
Expand All @@ -51,6 +52,8 @@
<td class="collapsing"><a href="{{ url_for('print_course', course_id=course.id) }}"><button type="button" class="ui button">PDF</button></a></td>
<td class="collapsing"><a href="{{ url_for('print_course_presence', course_id=course.id) }}"><button type="button" class="ui button">PDF</button></a></td>
<td class="collapsing"><a href="{{ url_for('export', type='course', id=course.id) }}"><button type="button" class="ui button">Export</button></a></td>
<td class="collapsing"><a href=" {{ url_for('edit_grade', course_id=course.id) }} ">
<button type="button" class="ui button"><i class="edit icon"></i></button></a>
</td>
</tr>
{% if sums.update({
Expand All @@ -75,6 +78,7 @@
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
Expand Down
2 changes: 1 addition & 1 deletion src/spz/templates/internal/teacher.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2>Meine Kurse</h2>
<td class="collapsing">
{{ course.count_attendances() }} / {{ course.limit }}
</td>
<td class="collapsing"><a href="{{ url_for('grade', id=teacher.id, course_id=course.id) }}">
<td class="collapsing"><a href="{{ url_for('grade', course_id=course.id) }}">
<button type="button" class="ui button">Notenübersicht</button>
</a></td>
<!--<td class="collapsing"><a href="{{ url_for('attendances', id=teacher.id, course_id=course.id) }}">
Expand Down

0 comments on commit 8740b3e

Please sign in to comment.