Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
c4dafba6
Commit
c4dafba6
authored
Aug 13, 2020
by
Bruno Martin
Browse files
fix progress methods
parent
b50cc400
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
courses/models.py
courses/models.py
+7
-3
No files found.
courses/models.py
View file @
c4dafba6
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment