Update access to deprecated enrollment.course (which now doesn't create the CourseOverview transparently)

This commit is contained in:
Calen Pennington
2017-08-08 10:59:21 -04:00
parent 84075efc81
commit 0faa683776
2 changed files with 4 additions and 5 deletions

View File

@@ -1009,7 +1009,6 @@ class CourseEnrollment(models.Model):
else:
self._course_id = value
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
@@ -1678,7 +1677,7 @@ class CourseEnrollment(models.Model):
If the course is re-published within the lifetime of this
CourseEnrollment object, then the value of this property will
become stale.
"""
"""
if not self._course_overview:
try:
self._course_overview = CourseOverview.get_from_id(self.course_id)

View File

@@ -88,11 +88,11 @@ def _listen_for_track_change(sender, user, **kwargs): # pylint: disable=unused-
user_enrollments = CourseEnrollment.enrollments_for_user(user=user)
grade_factory = CourseGradeFactory()
for enrollment in user_enrollments:
if grade_factory.read(user=user, course=enrollment.course).passed:
if fire_ungenerated_certificate_task(user, enrollment.course.id):
if grade_factory.read(user=user, course=enrollment.course_overview).passed:
if fire_ungenerated_certificate_task(user, enrollment.course_id):
log.info(u'Certificate generation task initiated for {user} : {course} via track change'.format(
user=user.id,
course=enrollment.course.id
course=enrollment.course_id
))