Commit b50cc400 authored by Laury Bueno's avatar Laury Bueno
Browse files

[Reports] Only count active users on course progress report

parent 8c6e0171
......@@ -209,9 +209,9 @@ class Course(models.Model):
def avg_lessons_users_progress(self, classes=None):
if classes:
student_enrolled = self.course_students.filter(
user__classes__in=classes).count()
user__classes__in=classes, user__is_active=True).count()
else:
student_enrolled = self.course_students.all().count()
student_enrolled = self.course_students.filter(user__is_active=True).count()
progress_list = []
for lesson in self.lessons.all():
lesson_progress = {}
......@@ -222,7 +222,7 @@ class Course(models.Model):
# avoid zero divisfion
if units_len and student_enrolled:
units_done = StudentProgress.objects.exclude(
complete=None).filter(unit__lesson=lesson)
complete=None, user__is_active=True).filter(unit__lesson=lesson)
if classes:
units_done = units_done.filter(user__classes__in=classes)
units_done_len = units_done.count()
......
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