Commit 0faa6837 by Calen Pennington

Update access to deprecated enrollment.course (which now doesn't create the…

Update access to deprecated enrollment.course (which now doesn't create the CourseOverview transparently)
parent 84075efc
...@@ -1009,7 +1009,6 @@ class CourseEnrollment(models.Model): ...@@ -1009,7 +1009,6 @@ class CourseEnrollment(models.Model):
else: else:
self._course_id = value self._course_id = value
created = models.DateTimeField(auto_now_add=True, null=True, db_index=True) created = models.DateTimeField(auto_now_add=True, null=True, db_index=True)
# If is_active is False, then the student is not considered to be enrolled # If is_active is False, then the student is not considered to be enrolled
...@@ -1678,7 +1677,7 @@ class CourseEnrollment(models.Model): ...@@ -1678,7 +1677,7 @@ class CourseEnrollment(models.Model):
If the course is re-published within the lifetime of this If the course is re-published within the lifetime of this
CourseEnrollment object, then the value of this property will CourseEnrollment object, then the value of this property will
become stale. become stale.
""" """
if not self._course_overview: if not self._course_overview:
try: try:
self._course_overview = CourseOverview.get_from_id(self.course_id) self._course_overview = CourseOverview.get_from_id(self.course_id)
......
...@@ -88,11 +88,11 @@ def _listen_for_track_change(sender, user, **kwargs): # pylint: disable=unused- ...@@ -88,11 +88,11 @@ def _listen_for_track_change(sender, user, **kwargs): # pylint: disable=unused-
user_enrollments = CourseEnrollment.enrollments_for_user(user=user) user_enrollments = CourseEnrollment.enrollments_for_user(user=user)
grade_factory = CourseGradeFactory() grade_factory = CourseGradeFactory()
for enrollment in user_enrollments: for enrollment in user_enrollments:
if grade_factory.read(user=user, course=enrollment.course).passed: if grade_factory.read(user=user, course=enrollment.course_overview).passed:
if fire_ungenerated_certificate_task(user, enrollment.course.id): if fire_ungenerated_certificate_task(user, enrollment.course_id):
log.info(u'Certificate generation task initiated for {user} : {course} via track change'.format( log.info(u'Certificate generation task initiated for {user} : {course} via track change'.format(
user=user.id, user=user.id,
course=enrollment.course.id course=enrollment.course_id
)) ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment