Skip to content
Snippets Groups Projects
Unverified Commit 137a271f authored by jawad khan's avatar jawad khan Committed by GitHub
Browse files

LEARNER-8158 - Fixed completion param issue (#26678)

* LEARNER-8158
Fixed completion param issue
- There is a case where we are sending requested_fields in params as comma separated list
e.g. requested_fields=children,show_gated_sections,graded,special_exam_info,completion.
- We didn't test for this case in first place and test cases were sending requested_fields as list.
- Now we can also handle this comma separated completion field which was getting ignored before.
parent fe085be4
No related branches found
Tags release-2020-11-19-11.11
No related merge requests found
......@@ -454,3 +454,14 @@ class TestBlocksInCourseView(TestBlocksView, CompletionWaffleTestMixin): # pyli
for block in response.data:
if block['block_id'] in self.non_orphaned_block_usage_keys:
assert block.get('completion')
def test_completion_all_course_with_requested_fields_as_string(self):
for block in self.non_orphaned_raw_block_usage_keys:
submit_completions_for_testing(self.user, [block])
response = self.verify_response(params={
'depth': 'all',
'requested_fields': 'completion,children',
})
for block_id in self.non_orphaned_block_usage_keys:
assert response.data['blocks'][block_id].get('completion')
......@@ -305,7 +305,9 @@ class BlocksInCourseView(BlocksView):
response = super().list(request, course_usage_key,
hide_access_denials=hide_access_denials) # lint-amnesty, pylint: disable=super-with-arguments
if 'completion' not in request.query_params.getlist('requested_fields', ''):
calculate_completion = any('completion' in param
for param in request.query_params.getlist('requested_fields', []))
if not calculate_completion:
return response
course_blocks = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment