Commit 66fab93a authored by Fernando Ribeiro's avatar Fernando Ribeiro
Browse files

Merge branch 'develop' into 'master'

Develop into master

See merge request !16
parents c4a82665 74edd24c
......@@ -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\
.filter(unit__lesson__in=self.course.lessons
......@@ -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):
@property
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:
......
......@@ -75,7 +75,7 @@ class SummaryViewSet(viewsets.ViewSet):
def __plpc_course_finished(activities, answers, units_len,
units_done_len, min_percent_to_complete):
return __percent_progress(units_len, units_done_len) > min_percent_to_complete and \
return __percent_progress(units_len, units_done_len) >= min_percent_to_complete and \
activities == answers
def __percent_progress(units_len, units_done_len):
......
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