Skip to content

Commit

Permalink
Fix importer prefetching not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
he3lixxx committed Dec 29, 2022
1 parent 7168efc commit e61b2b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions evap/staff/importers/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class NameEnCollisionException(Exception):
"""Course with same name_en, but different name_de exists"""

def __init__(self, semester: Semester):
courses = Course.objects.filter(semester=semester).prefetch_related("responsibles", "evaluations")
courses = Course.objects.filter(semester=semester).prefetch_related("type", "responsibles", "evaluations")

assert ("semester", "name_de") in Course._meta.unique_together
self.courses_by_name_de = {course.name_de: course for course in courses}
Expand All @@ -341,7 +341,7 @@ def get_merge_hindrances(course_data: CourseData, merge_candidate: Course) -> Li

if len(merge_candidate.evaluations.all()) != 1:
hindrances.append(_("the existing course does not have exactly one evaluation"))
elif merge_candidate.evaluations.get().wait_for_grade_upload_before_publishing != course_data.is_graded:
elif merge_candidate.evaluations.all()[0].wait_for_grade_upload_before_publishing != course_data.is_graded:
hindrances.append(_("the evaluation of the existing course has a mismatching grading specification"))

return hindrances
Expand Down

0 comments on commit e61b2b1

Please sign in to comment.