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
067c0331
Commit
067c0331
authored
Aug 26, 2014
by
Zia Fazal
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ziafazal/api-cohort-average-bug: skip discussion-forum
, discussion-course and group-work from calculations
parent
cd3e3a7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
lms/djangoapps/api_manager/courses/views.py
+8
-4
No files found.
lms/djangoapps/api_manager/courses/views.py
View file @
067c0331
...
...
@@ -1610,14 +1610,18 @@ class CoursesCompletionsLeadersList(SecureAPIView):
if
not
course_exists
(
request
,
request
.
user
,
course_id
):
return
Response
({},
status
=
status
.
HTTP_404_NOT_FOUND
)
course_key
=
get_course_key
(
course_id
)
total_possible_completions
=
len
(
get_course_leaf_nodes
(
course_key
,
[
'discussion-course'
,
'group-project'
]
))
detached_categories
=
[
'discussion-course'
,
'group-project'
,
'discussion-forum'
]
total_possible_completions
=
len
(
get_course_leaf_nodes
(
course_key
,
detached_categories
))
exclude_users
=
_get_aggregate_exclusion_user_ids
(
course_key
)
cat_list
=
[
Q
(
content_id__contains
=
item
.
strip
())
for
item
in
detached_categories
]
cat_list
=
reduce
(
lambda
a
,
b
:
a
|
b
,
cat_list
)
queryset
=
CourseModuleCompletion
.
objects
.
filter
(
course_id
=
course_key
)
\
.
exclude
(
user__in
=
exclude_users
)
.
exclude
(
user__in
=
exclude_users
)
.
exclude
(
cat_list
)
total_actual_completions
=
queryset
.
filter
(
user__is_active
=
True
)
.
count
()
if
user_id
:
user_queryset
=
CourseModuleCompletion
.
objects
.
filter
(
course_id
=
course_key
,
user__id
=
user_id
)
user_queryset
=
CourseModuleCompletion
.
objects
.
filter
(
course_id
=
course_key
,
user__id
=
user_id
)
\
.
exclude
(
cat_list
)
user_completions
=
user_queryset
.
count
()
user_time_completed
=
user_queryset
.
aggregate
(
time_completed
=
Max
(
'created'
))
user_time_completed
=
user_time_completed
[
'time_completed'
]
or
datetime
.
now
()
...
...
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