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
016c8200
Commit
016c8200
authored
9 years ago
by
lenacom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed comments
parent
236cf4e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lms/djangoapps/course_api/blocks/api.py
+3
-3
No files found.
lms/djangoapps/course_api/blocks/api.py
View file @
016c8200
...
...
@@ -45,6 +45,8 @@ def get_blocks(
which blocks to return their student_view_data.
return_type (string): Possible values are 'dict' or 'list'. Indicates
the format for returning the blocks.
block_types (list): Optional list of names of block types which to
return blocks.
"""
# create ordered list of transformers, adding BlocksAPITransformer at end.
transformers
=
BlockStructureTransformers
()
...
...
@@ -63,13 +65,11 @@ def get_blocks(
blocks
=
get_course_blocks
(
user
,
usage_key
,
transformers
)
# filter blocks by types
if
block_types
and
len
(
block_types
)
==
0
:
block_types
=
None
if
block_types
:
block_keys_to_remove
=
[]
for
block_key
in
blocks
:
block_type
=
blocks
.
get_xblock_field
(
block_key
,
'category'
)
if
not
block_type
in
block_types
:
if
block_type
not
in
block_types
:
block_keys_to_remove
.
append
(
block_key
)
for
block_key
in
block_keys_to_remove
:
blocks
.
remove_block
(
block_key
,
True
)
...
...
This diff is collapsed.
Click to expand it.
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