Commit c4dafba6 authored by Bruno Martin's avatar Bruno Martin
Browse files

fix progress methods

parent b50cc400
......@@ -341,7 +341,11 @@ class CourseStudent(models.Model):
return StudentProgress.objects.exclude(complete=None) \
.filter(user=self.user, unit__lesson__course=self.course)
def _plpc_course_finished(self):
def _activities_and_course_finished(self):
This method verifies if the user made all discussion activities
AND has the perent progress
from courses_learning_objects.models import LearningObject, Answer
activities = LearningObject.objects\
......@@ -350,7 +354,7 @@ class CourseStudent(models.Model):
answers = Answer.objects\
.filter(activity__in=activities, user=self.user)
return self.percent_progress() > self.min_percent_to_complete() and \
return self.percent_progress() >= self.min_percent_to_complete() and \
activities.count() == answers.count()
def _course_finished(self):
......@@ -359,7 +363,7 @@ class CourseStudent(models.Model):
def course_finished(self):
return self._plpc_course_finished()
return self._course_finished()
def can_emmit_receipt(self):
if not self.get_current_class().user_can_certificate and not self.course_finished:
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