Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-platform
Commits
37727216
Commit
37727216
authored
Aug 21, 2014
by
Sef Kloninger
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #111 from Stanford-Online/sef/dont-count-direct-access
direct access: exclude non-registered from enrollments
parents
00ce1d47
6b017485
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
common/djangoapps/student/models.py
+6
-2
lms/djangoapps/analytics/basic.py
+3
-0
No files found.
common/djangoapps/student/models.py
View file @
37727216
...
@@ -701,9 +701,13 @@ class CourseEnrollment(models.Model):
...
@@ -701,9 +701,13 @@ class CourseEnrollment(models.Model):
Returns the count of active enrollments in a course.
Returns the count of active enrollments in a course.
'course_id' is the course_id to return enrollments
'course_id' is the course_id to return enrollments
Direct access: don't include non-registered enrollments in counts.
"""
"""
enrollment_number
=
CourseEnrollment
.
objects
.
filter
(
course_id
=
course_id
,
is_active
=
1
)
.
count
()
enrollment_number
=
CourseEnrollment
.
objects
.
filter
(
course_id
=
course_id
,
is_active
=
1
,
user__profile__nonregistered
=
0
,
)
.
count
()
return
enrollment_number
return
enrollment_number
@classmethod
@classmethod
...
...
lms/djangoapps/analytics/basic.py
View file @
37727216
...
@@ -24,10 +24,13 @@ def enrolled_students_features(course_id, features):
...
@@ -24,10 +24,13 @@ def enrolled_students_features(course_id, features):
{'username': 'username2', 'first_name': 'firstname2'}
{'username': 'username2', 'first_name': 'firstname2'}
{'username': 'username3', 'first_name': 'firstname3'}
{'username': 'username3', 'first_name': 'firstname3'}
]
]
Direct access: don't include non-registered enrollments in result.
"""
"""
students
=
User
.
objects
.
filter
(
students
=
User
.
objects
.
filter
(
courseenrollment__course_id
=
course_id
,
courseenrollment__course_id
=
course_id
,
courseenrollment__is_active
=
1
,
courseenrollment__is_active
=
1
,
profile__nonregistered
=
0
,
)
.
order_by
(
'username'
)
.
select_related
(
'profile'
)
)
.
order_by
(
'username'
)
.
select_related
(
'profile'
)
def
extract_student
(
student
,
features
):
def
extract_student
(
student
,
features
):
...
...
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