Skip to content

Commit

Permalink
feat: childrenInfo field
Browse files Browse the repository at this point in the history
  • Loading branch information
rayzhou-bit committed Jan 3, 2024
1 parent 62e256b commit 3f6cb64
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ def handle_xblock(request, usage_key_string=None):
xblock, is_concise=True
)
return JsonResponse(ancestor_info)
elif "childrenInfo" in fields:
xblock = get_xblock(usage_key, request.user)
children_info = _create_xblock_child_info(
xblock,
course_outline=None,
graders=None,
include_children_predicate=ALWAYS,
is_concise=True
)
return JsonResponse(children_info)
# TODO: pass fields to get_block_info and only return those
with modulestore().bulk_operations(usage_key.course_key):
response = get_block_info(get_xblock(usage_key, request.user))
Expand Down Expand Up @@ -845,25 +855,14 @@ def get_block_info(
modulestore().get_course(xblock.location.course_key, depth=None)
)

# Note that children are returned for library_content blocks.
if category == "library_content":
xblock_info = create_xblock_info(
xblock,
data=data,
metadata=own_metadata(xblock),
include_ancestor_info=include_ancestor_info,
include_child_info=True,
include_children_predicate=ALWAYS
)
else:
xblock_info = create_xblock_info(
xblock,
data=data,
metadata=own_metadata(xblock),
include_ancestor_info=include_ancestor_info,
include_child_info=include_child_info,
include_children_predicate=include_children_predicate
)
# Note that children aren't being returned until we have a use case.
xblock_info = create_xblock_info(
xblock,
data=data,
metadata=own_metadata(xblock),
include_ancestor_info=include_ancestor_info,
include_children_predicate=include_children_predicate
)
if include_publishing_info:
add_container_page_publishing_info(xblock, xblock_info)

Expand Down

0 comments on commit 3f6cb64

Please sign in to comment.