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
a5f107bc
Commit
a5f107bc
authored
Oct 03, 2014
by
Zia Fazal
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ziafazal/api-remove-rounding: remove round in progress
avoid auto round by casting denominator to float
parent
a7a8e196
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
lms/djangoapps/api_manager/courses/serializers.py
+1
-1
lms/djangoapps/api_manager/courses/views.py
+3
-3
No files found.
lms/djangoapps/api_manager/courses/serializers.py
View file @
a5f107bc
...
...
@@ -48,7 +48,7 @@ class CourseCompletionsLeadersSerializer(serializers.Serializer):
completions
=
obj
[
'completions'
]
or
0
completion_percentage
=
0
if
total_completions
>
0
:
completion_percentage
=
int
(
round
(
100
*
completions
/
total_completions
)
)
completion_percentage
=
100
*
completions
/
float
(
total_completions
)
return
completion_percentage
...
...
lms/djangoapps/api_manager/courses/views.py
View file @
a5f107bc
...
...
@@ -1631,13 +1631,13 @@ class CoursesMetricsCompletionsLeadersList(SecureAPIView):
data
[
'position'
]
=
completions_above_user
+
1
completion_percentage
=
0
if
total_possible_completions
>
0
:
completion_percentage
=
int
(
round
(
100
*
user_completions
/
total_possible_completions
))
completion_percentage
=
100
*
user_completions
/
total_possible_completions
data
[
'completions'
]
=
completion_percentage
total_users
=
CourseEnrollment
.
users_enrolled_in
(
course_key
)
.
exclude
(
id__in
=
exclude_users
)
.
count
()
if
total_users
and
total_actual_completions
:
course_avg
=
round
(
total_actual_completions
/
float
(
total_users
),
1
)
course_avg
=
int
(
round
(
100
*
course_avg
/
total_possible_completions
))
# avg in percentage
course_avg
=
total_actual_completions
/
float
(
total_users
)
course_avg
=
100
*
course_avg
/
total_possible_completions
# avg in percentage
data
[
'course_avg'
]
=
course_avg
if
not
skipleaders
:
queryset
=
queryset
.
filter
(
user__is_active
=
True
)
.
values
(
'user__id'
,
'user__username'
,
...
...
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