refactor: rename module -> block within openedx/core

This commit is contained in:
0x29a
2022-12-30 11:08:43 +01:00
committed by Agrendalath
parent a027f36724
commit a299046540
5 changed files with 34 additions and 34 deletions

View File

@@ -94,7 +94,7 @@ class XBlockSerializer:
block.add_xml_to_node(olx_node)
block.children = children
# Now the block/module may have exported addtional data as files in
# Now the block may have exported addtional data as files in
# 'filesystem'. If so, store them:
for item in filesystem.walk(): # pylint: disable=not-callable
for unit_file in item.files:

View File

@@ -19,8 +19,8 @@ from xmodule.partitions.partitions import Group, UserPartition # lint-amnesty,
class ContentGroupTestCase(ModuleStoreTestCase):
"""
Sets up discussion modules visible to content groups 'Alpha' and
'Beta', as well as a module visible to all students. Creates a
Sets up discussion blocks visible to content groups 'Alpha' and
'Beta', as well as a block visible to all students. Creates a
staff user, users with access to Alpha/Beta (by way of cohorts),
and a non-cohorted user with no special access.
"""
@@ -99,21 +99,21 @@ class ContentGroupTestCase(ModuleStoreTestCase):
partition_id=self.course.user_partitions[0].id,
group_id=self.course.user_partitions[0].groups[1].id
)
self.alpha_module = BlockFactory.create(
self.alpha_block = BlockFactory.create(
parent_location=self.course.location,
category='discussion',
discussion_id='alpha_group_discussion',
discussion_target='Visible to Alpha',
group_access={self.course.user_partitions[0].id: [self.course.user_partitions[0].groups[0].id]}
)
self.beta_module = BlockFactory.create(
self.beta_block = BlockFactory.create(
parent_location=self.course.location,
category='discussion',
discussion_id='beta_group_discussion',
discussion_target='Visible to Beta',
group_access={self.course.user_partitions[0].id: [self.course.user_partitions[0].groups[1].id]}
)
self.global_module = BlockFactory.create(
self.global_block = BlockFactory.create(
parent_location=self.course.location,
category='discussion',
discussion_id='global_group_discussion',

View File

@@ -21,6 +21,6 @@ class PageNotFoundError(ObjectDoesNotExist):
class DiscussionNotFoundError(ObjectDoesNotExist):
"""
Discussion Module was not found.
Discussion Block was not found.
"""
pass # lint-amnesty, pylint: disable=unnecessary-pass

View File

@@ -225,11 +225,11 @@ def wrap_xblock_aside(
return wrap_fragment(frag, render_to_string('xblock_wrapper.html', template_context))
def grade_histogram(module_id):
def grade_histogram(block_id):
'''
Print out a histogram of grades on a given problem in staff member debug info.
Warning: If a student has just looked at an xmodule and not attempted
Warning: If a student has just looked at an xblock and not attempted
it, their grade is None. Since there will always be at least one such student
this function almost always returns [].
'''
@@ -242,8 +242,8 @@ def grade_histogram(module_id):
FROM courseware_studentmodule
WHERE courseware_studentmodule.module_id=%s
GROUP BY courseware_studentmodule.grade"""
# Passing module_id this way prevents sql-injection.
cursor.execute(query, [str(module_id)])
# Passing block_id this way prevents sql-injection.
cursor.execute(query, [str(block_id)])
grades = list(cursor.fetchall())
grades.sort(key=lambda x: x[0]) # Add ORDER BY to sql query?
@@ -262,13 +262,13 @@ def sanitize_html_id(html_id):
def add_staff_markup(user, disable_staff_debug_info, block, view, frag, context): # pylint: disable=unused-argument
"""
Updates the supplied module with a new get_html function that wraps
Updates the supplied block with a new get_html function that wraps
the output of the old get_html function with additional information
for admin users only, including a histogram of student answers, the
definition of the xmodule, and a link to view the module in Studio
definition of the xblock, and a link to view the block in Studio
if it is a Studio edited, mongo stored course.
Does nothing if module is a SequenceBlock.
Does nothing if block is a SequenceBlock.
"""
if context and context.get('hide_staff_markup', False):
# If hide_staff_markup is passed, don't add the markup