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
edx
edx-platform
Commits
b98fe5bf
Commit
b98fe5bf
authored
Aug 21, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed analytics counts on instructor dashboard.
LMS-11228
parent
3ac3a315
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
+24
-1
lms/djangoapps/instructor_analytics/distributions.py
+3
-1
lms/djangoapps/instructor_analytics/tests/test_distributions.py
+21
-0
No files found.
lms/djangoapps/instructor_analytics/distributions.py
View file @
b98fe5bf
...
...
@@ -123,6 +123,7 @@ def profile_distribution(course_id, feature):
""" Get the count of enrolled students matching the feature value. """
return
CourseEnrollment
.
objects
.
filter
(
course_id
=
course_id
,
is_active
=
True
,
**
get_filter
(
feature
,
value
)
)
.
count
()
...
...
@@ -141,7 +142,8 @@ def profile_distribution(course_id, feature):
elif
feature
in
_OPEN_CHOICE_FEATURES
:
prd
.
type
=
'OPEN_CHOICE'
profiles
=
UserProfile
.
objects
.
filter
(
user__courseenrollment__course_id
=
course_id
user__courseenrollment__course_id
=
course_id
,
user__courseenrollment__is_active
=
True
)
query_distribution
=
profiles
.
values
(
feature
)
.
annotate
(
Count
(
feature
))
.
order_by
()
...
...
lms/djangoapps/instructor_analytics/tests/test_distributions.py
View file @
b98fe5bf
...
...
@@ -17,6 +17,7 @@ class TestAnalyticsDistributions(TestCase):
self
.
users
=
[
UserFactory
(
profile__gender
=
[
'm'
,
'f'
,
'o'
][
i
%
3
],
profile__level_of_education
=
[
'a'
,
'hs'
,
'el'
][
i
%
3
],
profile__year_of_birth
=
i
+
1930
)
for
i
in
xrange
(
30
)]
...
...
@@ -49,6 +50,26 @@ class TestAnalyticsDistributions(TestCase):
self
.
assertNotIn
(
'no_data'
,
distribution
.
data
)
self
.
assertEqual
(
distribution
.
data
[
1930
],
1
)
def
test_gender_count
(
self
):
course_enrollments
=
CourseEnrollment
.
objects
.
filter
(
course_id
=
self
.
course_id
,
user__profile__gender
=
'm'
)
distribution
=
profile_distribution
(
self
.
course_id
,
"gender"
)
self
.
assertEqual
(
distribution
.
data
[
'm'
],
len
(
course_enrollments
))
course_enrollments
[
0
]
.
deactivate
()
distribution
=
profile_distribution
(
self
.
course_id
,
"gender"
)
self
.
assertEqual
(
distribution
.
data
[
'm'
],
len
(
course_enrollments
)
-
1
)
def
test_level_of_education_count
(
self
):
course_enrollments
=
CourseEnrollment
.
objects
.
filter
(
course_id
=
self
.
course_id
,
user__profile__level_of_education
=
'hs'
)
distribution
=
profile_distribution
(
self
.
course_id
,
"level_of_education"
)
self
.
assertEqual
(
distribution
.
data
[
'hs'
],
len
(
course_enrollments
))
course_enrollments
[
0
]
.
deactivate
()
distribution
=
profile_distribution
(
self
.
course_id
,
"level_of_education"
)
self
.
assertEqual
(
distribution
.
data
[
'hs'
],
len
(
course_enrollments
)
-
1
)
class
TestAnalyticsDistributionsNoData
(
TestCase
):
'''Test analytics distribution gathering.'''
...
...
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