Skip to content

Commit

Permalink
fix: [AXIMST-819] fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan committed May 14, 2024
1 parent 8e16c31 commit 05502e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lms/djangoapps/course_home_api/outline/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def test_empty_blocks_complete(self):
"""
self.add_blocks_to_course()
CourseEnrollment.enroll(self.user, self.course.id)
url = reverse('course-home:course-sidebar-blocks', args=[self.course.id])
url = reverse('course-home:course-navigation', args=[self.course.id])
response = self.client.get(url)
assert response.status_code == 200

Expand All @@ -731,7 +731,7 @@ def test_blocks_complete_with_problem(self, problem_complete):
CourseEnrollment.enroll(self.user, self.course.id)
self.create_completion(problem, int(problem_complete))

response = self.client.get(reverse('course-home:course-sidebar-blocks', args=[self.course.id]))
response = self.client.get(reverse('course-home:course-navigation', args=[self.course.id]))

sequence_data = response.data['blocks'][str(self.sequential.location)]
vertical_data = response.data['blocks'][str(self.vertical.location)]
Expand All @@ -750,7 +750,7 @@ def test_blocks_completion_stat(self):
CourseEnrollment.enroll(self.user, self.course.id)
self.create_completion(completed_problem, 1)
self.create_completion(uncompleted_problem, 0)
response = self.client.get(reverse('course-home:course-sidebar-blocks', args=[self.course.id]))
response = self.client.get(reverse('course-home:course-navigation', args=[self.course.id]))

expected_sequence_completion_stat = {
'completion': 0,
Expand Down Expand Up @@ -779,7 +779,7 @@ def test_blocks_completion_stat_all_problem_completed(self):
CourseEnrollment.enroll(self.user, self.course.id)
self.create_completion(problem1, 1)
self.create_completion(problem2, 1)
response = self.client.get(reverse('course-home:course-sidebar-blocks', args=[self.course.id]))
response = self.client.get(reverse('course-home:course-navigation', args=[self.course.id]))

expected_sequence_completion_stat = {
'completion': 1,
Expand Down
5 changes: 4 additions & 1 deletion lms/djangoapps/course_home_api/outline/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,11 @@ def mark_complete_recursive(self, block):
"""
Mark blocks as complete or not complete based on the completions_dict.
"""
if not block:
return block

if 'children' in block:
block['children'] = [self.mark_complete_recursive(child) for child in block['children']]
block['children'] = [self.mark_complete_recursive(child) for child in block['children'] if child]
completable_children = self.get_completable_children(block)
block['complete'] = all(child['complete'] for child in completable_children)
block['completion_stat'] = self.get_block_completion_stat(block, completable_children)
Expand Down

0 comments on commit 05502e5

Please sign in to comment.