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
97cf6dd4
Commit
97cf6dd4
authored
Jan 31, 2016
by
Douglas Hall
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11385 from edx/douglashall/fix_xmodule_import
Remove gating api import from course xmodule
parents
907d3e9f
7c923355
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
14 deletions
+5
-14
cms/djangoapps/contentstore/views/item.py
+4
-0
cms/djangoapps/contentstore/views/tests/test_gating.py
+1
-1
common/lib/xmodule/xmodule/course_module.py
+0
-13
No files found.
cms/djangoapps/contentstore/views/item.py
View file @
97cf6dd4
...
@@ -780,6 +780,10 @@ def _get_gating_info(course, xblock):
...
@@ -780,6 +780,10 @@ def _get_gating_info(course, xblock):
"""
"""
info
=
{}
info
=
{}
if
xblock
.
category
==
'sequential'
and
course
.
enable_subsection_gating
:
if
xblock
.
category
==
'sequential'
and
course
.
enable_subsection_gating
:
if
not
hasattr
(
course
,
'gating_prerequisites'
):
# Cache gating prerequisites on course module so that we are not
# hitting the database for every xblock in the course
setattr
(
course
,
'gating_prerequisites'
,
gating_api
.
get_prerequisites
(
course
.
id
))
# pylint: disable=literal-used-as-attribute
info
[
"is_prereq"
]
=
gating_api
.
is_prerequisite
(
course
.
id
,
xblock
.
location
)
info
[
"is_prereq"
]
=
gating_api
.
is_prerequisite
(
course
.
id
,
xblock
.
location
)
info
[
"prereqs"
]
=
[
info
[
"prereqs"
]
=
[
p
for
p
in
course
.
gating_prerequisites
if
unicode
(
xblock
.
location
)
not
in
p
[
'namespace'
]
p
for
p
in
course
.
gating_prerequisites
if
unicode
(
xblock
.
location
)
not
in
p
[
'namespace'
]
...
...
cms/djangoapps/contentstore/views/tests/test_gating.py
View file @
97cf6dd4
...
@@ -108,7 +108,7 @@ class TestSubsectionGating(CourseTestCase):
...
@@ -108,7 +108,7 @@ class TestSubsectionGating(CourseTestCase):
''
''
)
)
@patch
(
'
xmodule.course_module
.gating_api.get_prerequisites'
)
@patch
(
'
contentstore.views.item
.gating_api.get_prerequisites'
)
@patch
(
'contentstore.views.item.gating_api.get_required_content'
)
@patch
(
'contentstore.views.item.gating_api.get_required_content'
)
@patch
(
'contentstore.views.item.gating_api.is_prerequisite'
)
@patch
(
'contentstore.views.item.gating_api.is_prerequisite'
)
def
test_get_prerequisite
(
self
,
mock_is_prereq
,
mock_get_required_content
,
mock_get_prereqs
):
def
test_get_prerequisite
(
self
,
mock_is_prereq
,
mock_get_required_content
,
mock_get_prereqs
):
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
97cf6dd4
...
@@ -14,7 +14,6 @@ from path import Path as path
...
@@ -14,7 +14,6 @@ from path import Path as path
from
xblock.core
import
XBlock
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
List
,
String
,
Dict
,
Boolean
,
Integer
,
Float
from
xblock.fields
import
Scope
,
List
,
String
,
Dict
,
Boolean
,
Integer
,
Float
from
openedx.core.lib.gating
import
api
as
gating_api
from
xmodule
import
course_metadata_utils
from
xmodule
import
course_metadata_utils
from
xmodule.course_metadata_utils
import
DEFAULT_START_DATE
from
xmodule.course_metadata_utils
import
DEFAULT_START_DATE
from
xmodule.exceptions
import
UndefinedContext
from
xmodule.exceptions
import
UndefinedContext
...
@@ -1395,18 +1394,6 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
...
@@ -1395,18 +1394,6 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
"""
"""
return
datetime
.
now
(
UTC
())
<=
self
.
start
return
datetime
.
now
(
UTC
())
<=
self
.
start
@property
def
gating_prerequisites
(
self
):
"""
Course content that can be used to gate other course content within this course.
Returns:
list: Returns a list of dicts containing the gating milestone data
"""
if
not
self
.
_gating_prerequisites
:
self
.
_gating_prerequisites
=
gating_api
.
get_prerequisites
(
self
.
id
)
return
self
.
_gating_prerequisites
class
CourseSummary
(
object
):
class
CourseSummary
(
object
):
"""
"""
...
...
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