Skip to content

Commit

Permalink
quickfix: copy grades from applicant to attendance
Browse files Browse the repository at this point in the history
  • Loading branch information
urvdp committed Jul 25, 2024
1 parent 21c4d28 commit 70bbba9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/spz/administration/admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ def grade(course_id):

exam_date = app.config['EXAM_DATE']

# Quickfix: structure change because of bug, but I need to set the already set grades and copy to new structure
for applicant in course.course_list:
attendance = course.get_course_attendance(course.id, applicant.id)
if applicant.grade is not None and attendance.grade is None:
# only update initially with applicant grade values
attendance.grade = applicant.grade
attendance.hide_grade = applicant.hide_grade
db.session.commit()

return dict(course=course, exam_date=exam_date)


Expand All @@ -261,15 +270,6 @@ def edit_grade(course_id):
attendance.ects_points = course.ects_points
db.session.commit()

# Quickfix: structure change because of bug, but I need to set the already set grades and copy to new structure
for applicant in course.course_list:
attendance = course.get_course_attendance(course.id, applicant.id)
if applicant.grade is not None and attendance.grade is None:
# only update initially with applicant grade values
attendance.grade = applicant.grade
attendance.hide_grade = applicant.hide_grade
db.session.commit()

if request.method == 'POST' and form.validate():
try:
changes = False
Expand Down

0 comments on commit 70bbba9

Please sign in to comment.