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
00802f7f
Commit
00802f7f
authored
Oct 23, 2014
by
Zia Fazal
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ziafazal/api-strip-unenrolled-users-from-social-stats
strip un-enrolled users from social stats
parent
7959d2db
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
lms/djangoapps/api_manager/courses/views.py
+8
-7
No files found.
lms/djangoapps/api_manager/courses/views.py
View file @
00802f7f
...
...
@@ -1802,17 +1802,18 @@ class CoursesMetricsSocial(SecureListAPIView):
for
user_id
in
exclude_users
:
if
str
(
user_id
)
in
data
:
del
data
[
str
(
user_id
)]
enrollment_qs
=
CourseEnrollment
.
users_enrolled_in
(
course_key
)
.
exclude
(
id__in
=
exclude_users
)
enrollment_qs
=
CourseEnrollment
.
users_enrolled_in
(
course_key
)
.
filter
(
is_active
=
True
)
\
.
exclude
(
id__in
=
exclude_users
)
actual_data
=
{}
if
organization
:
enrollment_qs
=
enrollment_qs
.
filter
(
organizations
=
organization
)
users_in_org
=
enrollment_qs
.
values_list
(
'id'
,
flat
=
True
)
# extract org users
org_data
=
{}
for
user_id
in
users_in_org
:
actual_users
=
enrollment_qs
.
values_list
(
'id'
,
flat
=
True
)
for
user_id
in
actual_users
:
if
str
(
user_id
)
in
data
:
org_data
.
update
({
str
(
user_id
):
data
[
str
(
user_id
)]})
data
=
org_data
actual_data
.
update
({
str
(
user_id
):
data
[
str
(
user_id
)]})
data
=
actual_data
total_enrollments
=
enrollment_qs
.
count
()
data
=
{
'total_enrollments'
:
total_enrollments
,
'users'
:
data
}
http_status
=
status
.
HTTP_200_OK
...
...
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