Skip to content

Commit

Permalink
refactor: rename descriptor -> block within lms/djangoapps/lti_provider
Browse files Browse the repository at this point in the history
Co-authored-by: Agrendalath <piotr@surowiec.it>
  • Loading branch information
pkulkark and Agrendalath committed Apr 26, 2023
1 parent 5cc6aca commit 4276e7d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lms/djangoapps/lti_provider/outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def generate_replace_result_xml(result_sourcedid, score):
return etree.tostring(xml, xml_declaration=True, encoding='UTF-8')


def get_assignments_for_problem(problem_descriptor, user_id, course_key):
def get_assignments_for_problem(problem_block, user_id, course_key):
"""
Trace the parent hierarchy from a given problem to find all blocks that
correspond to graded assignment launches for this user. A problem may
Expand All @@ -107,13 +107,13 @@ def get_assignments_for_problem(problem_descriptor, user_id, course_key):
problem and as a problem in a vertical, for example).
Returns a list of GradedAssignment objects that are associated with the
given descriptor for the current user.
given block for the current user.
"""
locations = []
current_descriptor = problem_descriptor
while current_descriptor:
locations.append(current_descriptor.location)
current_descriptor = current_descriptor.get_parent()
current_block = problem_block
while current_block:
locations.append(current_block.location)
current_block = current_block.get_parent()
assignments = GradedAssignment.objects.filter(
user=user_id, course_key=course_key, usage_key__in=locations
)
Expand Down
4 changes: 2 additions & 2 deletions lms/djangoapps/lti_provider/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def increment_assignment_versions(course_key, usage_key, user_id):
Update the version numbers for all assignments that are affected by a score
change event. Returns a list of all affected assignments.
"""
problem_descriptor = modulestore().get_item(usage_key)
problem_block = modulestore().get_item(usage_key)
# Get all assignments involving the current problem for which the campus LMS
# is expecting a grade. There may be many possible graded assignments, if
# a problem has been added several times to a course at different
# granularities (such as the unit or the vertical).
assignments = outcomes.get_assignments_for_problem(
problem_descriptor, user_id, course_key
problem_block, user_id, course_key
)
for assignment in assignments:
assignment.version_number += 1
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/lti_provider/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class SendCompositeOutcomeTest(BaseOutcomeTest):

def setUp(self):
super().setUp()
self.descriptor = MagicMock()
self.descriptor.location = BlockUsageLocator(
self.block = MagicMock()
self.block.location = BlockUsageLocator(
course_key=self.course_key,
block_type='problem',
block_id='problem',
Expand All @@ -108,7 +108,7 @@ def setUp(self):
'lms.djangoapps.lti_provider.tasks.CourseGradeFactory.read', self.course_grade
)
self.module_store = MagicMock()
self.module_store.get_item = MagicMock(return_value=self.descriptor)
self.module_store.get_item = MagicMock(return_value=self.block)
self.check_result_mock = self.setup_patch(
'lms.djangoapps.lti_provider.tasks.modulestore',
self.module_store
Expand Down

0 comments on commit 4276e7d

Please sign in to comment.