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
c7b2d987
Commit
c7b2d987
authored
May 02, 2016
by
Douglas Hall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow content gating to work with library_content blocks
parent
5b26a2f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
lms/djangoapps/courseware/grades.py
+1
-1
lms/djangoapps/courseware/tests/test_grades.py
+41
-2
No files found.
lms/djangoapps/courseware/grades.py
View file @
c7b2d987
...
...
@@ -839,7 +839,7 @@ def _calculate_score_for_modules(user_id, course, modules):
# Iterate over all of the exam modules to get score percentage of user for each of them
module_percentages
=
[]
ignore_categories
=
[
'course'
,
'chapter'
,
'sequential'
,
'vertical'
,
'randomize'
]
ignore_categories
=
[
'course'
,
'chapter'
,
'sequential'
,
'vertical'
,
'randomize'
,
'library_content'
]
for
index
,
module
in
enumerate
(
modules
):
if
module
.
category
not
in
ignore_categories
and
(
module
.
graded
or
module
.
has_score
):
module_score
=
scores_client
.
get
(
locations
[
index
])
...
...
lms/djangoapps/courseware/tests/test_grades.py
View file @
c7b2d987
...
...
@@ -366,13 +366,19 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
cls
.
seq1
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
'sequential'
,
display_name
=
"Test Sequential"
,
display_name
=
"Test Sequential
1
"
,
graded
=
True
)
cls
.
seq2
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
'sequential'
,
display_name
=
"Test Sequential"
,
display_name
=
"Test Sequential 2"
,
graded
=
True
)
cls
.
seq3
=
ItemFactory
.
create
(
parent
=
cls
.
chapter
,
category
=
'sequential'
,
display_name
=
"Test Sequential 3"
,
graded
=
True
)
cls
.
vert1
=
ItemFactory
.
create
(
...
...
@@ -385,11 +391,21 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
category
=
'vertical'
,
display_name
=
'Test Vertical 2'
)
cls
.
vert3
=
ItemFactory
.
create
(
parent
=
cls
.
seq3
,
category
=
'vertical'
,
display_name
=
'Test Vertical 3'
)
cls
.
randomize
=
ItemFactory
.
create
(
parent
=
cls
.
vert2
,
category
=
'randomize'
,
display_name
=
'Test Randomize'
)
cls
.
library_content
=
ItemFactory
.
create
(
parent
=
cls
.
vert3
,
category
=
'library_content'
,
display_name
=
'Test Library Content'
)
problem_xml
=
MultipleChoiceResponseXMLFactory
()
.
build_xml
(
question_text
=
'The correct answer is Choice 3'
,
choices
=
[
False
,
False
,
True
,
False
],
...
...
@@ -420,6 +436,19 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
data
=
problem_xml
)
cls
.
problem5
=
ItemFactory
.
create
(
parent
=
cls
.
library_content
,
category
=
"problem"
,
display_name
=
"Test Problem 5"
,
data
=
problem_xml
)
cls
.
problem6
=
ItemFactory
.
create
(
parent
=
cls
.
library_content
,
category
=
"problem"
,
display_name
=
"Test Problem 6"
,
data
=
problem_xml
)
def
setUp
(
self
):
"""
Set up test course
...
...
@@ -485,6 +514,16 @@ class TestGetModuleScore(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
score
=
get_module_score
(
self
.
request
.
user
,
self
.
course
,
self
.
seq2
)
self
.
assertEqual
(
score
,
1.0
)
def
test_get_module_score_with_library_content
(
self
):
"""
Test test_get_module_score_with_library_content
"""
answer_problem
(
self
.
course
,
self
.
request
,
self
.
problem5
)
answer_problem
(
self
.
course
,
self
.
request
,
self
.
problem6
)
score
=
get_module_score
(
self
.
request
.
user
,
self
.
course
,
self
.
seq3
)
self
.
assertEqual
(
score
,
1.0
)
def
answer_problem
(
course
,
request
,
problem
,
score
=
1
):
"""
...
...
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