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
4921ec48
Commit
4921ec48
authored
Jun 05, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MA-792 Course Blocks and Navigation API (user-specific)
parent
037ef3be
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
11 deletions
+55
-11
common/djangoapps/util/module_utils.py
+8
-4
common/lib/xmodule/xmodule/video_module/video_module.py
+2
-1
lms/djangoapps/course_structure_api/v0/tests.py
+0
-0
lms/djangoapps/course_structure_api/v0/urls.py
+29
-1
lms/djangoapps/course_structure_api/v0/views.py
+0
-0
lms/djangoapps/courseware/entrance_exams.py
+3
-2
lms/djangoapps/courseware/grades.py
+7
-3
lms/djangoapps/mobile_api/video_outlines/serializers.py
+1
-0
lms/envs/common.py
+3
-0
lms/envs/test.py
+2
-0
No files found.
common/djangoapps/util/module_utils.py
View file @
4921ec48
...
...
@@ -3,7 +3,7 @@ Utility library containing operations used/shared by multiple courseware modules
"""
def
yield_dynamic_descriptor_descend
ents
(
descriptor
,
module_creator
):
# pylint: disable=invalid-name
def
yield_dynamic_descriptor_descend
ants
(
descriptor
,
user_id
,
module_creator
):
# pylint: disable=invalid-name
"""
This returns all of the descendants of a descriptor. If the descriptor
has dynamic children, the module will be created using module_creator
...
...
@@ -13,17 +13,21 @@ def yield_dynamic_descriptor_descendents(descriptor, module_creator): # pylint:
while
len
(
stack
)
>
0
:
next_descriptor
=
stack
.
pop
()
stack
.
extend
(
get_dynamic_descriptor_children
(
next_descriptor
,
module_creator
))
stack
.
extend
(
get_dynamic_descriptor_children
(
next_descriptor
,
user_id
,
module_creator
))
yield
next_descriptor
def
get_dynamic_descriptor_children
(
descriptor
,
module_creator
,
usage_key_filter
=
None
):
def
get_dynamic_descriptor_children
(
descriptor
,
user_id
,
module_creator
=
None
,
usage_key_filter
=
None
):
"""
Returns the children of the given descriptor, while supporting descriptors with dynamic children.
"""
module_children
=
[]
if
descriptor
.
has_dynamic_children
():
module
=
module_creator
(
descriptor
)
# do not rebind the module if it's already bound to a user.
if
descriptor
.
scope_ids
.
user_id
and
user_id
==
descriptor
.
scope_ids
.
user_id
:
module
=
descriptor
else
:
module
=
module_creator
(
descriptor
)
if
module
is
not
None
:
module_children
=
module
.
get_child_descriptors
()
else
:
...
...
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
4921ec48
...
...
@@ -755,7 +755,8 @@ class VideoDescriptor(VideoFields, VideoTranscriptsMixin, VideoStudioViewHandler
Returns a JSON representation of the student_view of this XModule.
The contract of the JSON content is between the caller and the particular XModule.
"""
# Honor only_on_web
# If the "only_on_web" field is set on this video, do not return the rest of the video's data
# in this json view, since this video is to be accessed only through its web view."
if
self
.
only_on_web
:
return
{
"only_on_web"
:
True
}
...
...
lms/djangoapps/course_structure_api/v0/tests.py
View file @
4921ec48
This diff is collapsed.
Click to expand it.
lms/djangoapps/course_structure_api/v0/urls.py
View file @
4921ec48
...
...
@@ -14,5 +14,33 @@ urlpatterns = patterns(
url
(
r'^courses/$'
,
views
.
CourseList
.
as_view
(),
name
=
'list'
),
url
(
r'^courses/{}/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseDetail
.
as_view
(),
name
=
'detail'
),
url
(
r'^course_structures/{}/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseStructure
.
as_view
(),
name
=
'structure'
),
url
(
r'^grading_policies/{}/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseGradingPolicy
.
as_view
(),
name
=
'grading_policy'
)
url
(
r'^grading_policies/{}/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseGradingPolicy
.
as_view
(),
name
=
'grading_policy'
),
)
if
settings
.
FEATURES
.
get
(
'ENABLE_COURSE_BLOCKS_NAVIGATION_API'
):
# TODO (MA-789) This endpoint still needs to be approved by the arch council.
# TODO (MA-704) This endpoint still needs to be made performant.
urlpatterns
+=
(
url
(
r'^courses/{}/blocks/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseBlocksAndNavigation
.
as_view
(),
{
'return_blocks'
:
True
,
'return_nav'
:
False
},
name
=
'blocks'
),
url
(
r'^courses/{}/navigation/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseBlocksAndNavigation
.
as_view
(),
{
'return_blocks'
:
False
,
'return_nav'
:
True
},
name
=
'navigation'
),
url
(
r'^courses/{}/blocks\+navigation/$'
.
format
(
COURSE_ID_PATTERN
),
views
.
CourseBlocksAndNavigation
.
as_view
(),
{
'return_blocks'
:
True
,
'return_nav'
:
True
},
name
=
'blocks+navigation'
),
)
lms/djangoapps/course_structure_api/v0/views.py
View file @
4921ec48
This diff is collapsed.
Click to expand it.
lms/djangoapps/courseware/entrance_exams.py
View file @
4921ec48
...
...
@@ -9,7 +9,7 @@ from courseware.models import StudentModule
from
opaque_keys.edx.keys
import
UsageKey
from
student.models
import
EntranceExamConfiguration
from
util.milestones_helpers
import
get_required_content
from
util.module_utils
import
yield_dynamic_descriptor_descend
e
nts
from
util.module_utils
import
yield_dynamic_descriptor_descend
a
nts
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -147,8 +147,9 @@ def get_entrance_exam_score(request, course):
course
.
id
)
exam_module_generators
=
yield_dynamic_descriptor_descend
e
nts
(
exam_module_generators
=
yield_dynamic_descriptor_descend
a
nts
(
exam_descriptor
,
request
.
user
.
id
,
inner_get_module
)
exam_modules
=
[
module
for
module
in
exam_module_generators
]
...
...
lms/djangoapps/courseware/grades.py
View file @
4921ec48
...
...
@@ -15,7 +15,7 @@ import dogstats_wrapper as dog_stats_api
from
courseware
import
courses
from
courseware.model_data
import
FieldDataCache
from
student.models
import
anonymous_id_for_user
from
util.module_utils
import
yield_dynamic_descriptor_descend
e
nts
from
util.module_utils
import
yield_dynamic_descriptor_descend
a
nts
from
xmodule
import
graders
from
xmodule.graders
import
Score
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -209,7 +209,9 @@ def _grade(student, request, course, keep_raw_scores):
field_data_cache
=
FieldDataCache
([
descriptor
],
course
.
id
,
student
)
return
get_module_for_descriptor
(
student
,
request
,
descriptor
,
field_data_cache
,
course
.
id
)
for
module_descriptor
in
yield_dynamic_descriptor_descendents
(
section_descriptor
,
create_module
):
for
module_descriptor
in
yield_dynamic_descriptor_descendants
(
section_descriptor
,
student
.
id
,
create_module
):
(
correct
,
total
)
=
get_score
(
course
.
id
,
student
,
module_descriptor
,
create_module
,
scores_cache
=
submissions_scores
...
...
@@ -364,7 +366,9 @@ def _progress_summary(student, request, course):
module_creator
=
section_module
.
xmodule_runtime
.
get_module
for
module_descriptor
in
yield_dynamic_descriptor_descendents
(
section_module
,
module_creator
):
for
module_descriptor
in
yield_dynamic_descriptor_descendants
(
section_module
,
student
.
id
,
module_creator
):
course_id
=
course
.
id
(
correct
,
total
)
=
get_score
(
course_id
,
student
,
module_descriptor
,
module_creator
,
scores_cache
=
submissions_scores
...
...
lms/djangoapps/mobile_api/video_outlines/serializers.py
View file @
4921ec48
...
...
@@ -86,6 +86,7 @@ class BlockOutline(object):
if
curr_block
.
has_children
:
children
=
get_dynamic_descriptor_children
(
curr_block
,
self
.
request
.
user
.
id
,
create_module
,
usage_key_filter
=
parent_or_requested_block_type
)
...
...
lms/envs/common.py
View file @
4921ec48
...
...
@@ -321,7 +321,10 @@ FEATURES = {
# ENABLE_OAUTH2_PROVIDER to True
'ENABLE_MOBILE_REST_API'
:
False
,
'ENABLE_MOBILE_SOCIAL_FACEBOOK_FEATURES'
:
False
,
# Enable APIs required for xBlocks on Mobile, and supported in general
'ENABLE_RENDER_XBLOCK_API'
:
False
,
'ENABLE_COURSE_BLOCKS_NAVIGATION_API'
:
False
,
# Enable the combined login/registration form
'ENABLE_COMBINED_LOGIN_REGISTRATION'
:
False
,
...
...
lms/envs/test.py
View file @
4921ec48
...
...
@@ -268,6 +268,8 @@ FEATURES['ENABLE_OAUTH2_PROVIDER'] = True
FEATURES
[
'ENABLE_MOBILE_REST_API'
]
=
True
FEATURES
[
'ENABLE_MOBILE_SOCIAL_FACEBOOK_FEATURES'
]
=
True
FEATURES
[
'ENABLE_VIDEO_ABSTRACTION_LAYER_API'
]
=
True
FEATURES
[
'ENABLE_COURSE_BLOCKS_NAVIGATION_API'
]
=
True
FEATURES
[
'ENABLE_RENDER_XBLOCK_API'
]
=
True
###################### Payment ##############################3
# Enable fake payment processing page
...
...
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