Skip to content

Commit

Permalink
feat: handle optional blocks in verticals
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVZ96 committed Feb 27, 2024
1 parent 2749c04 commit 51c5c24
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Change Log
Unreleased
~~~~~~~~~~

[4.5.0] - 2024-02-26
~~~~~~~~~~~~~~~~~~~~
* Ignore optional blocks in non-optional verticals

[4.4.1] - 2023-10-27
~~~~~~~~~~~~~~~~~~~~
* Fix RemovedInDjango41Warning by removing `django_app_config`
Expand Down
2 changes: 1 addition & 1 deletion completion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""


__version__ = '4.4.1'
__version__ = '4.5.0'
8 changes: 7 additions & 1 deletion completion/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,14 @@ def vertical_is_complete(self, item):
if not self.completion_tracking_enabled():
return None

optional_vertical = getattr(item, "optional_content", False)

Check warning on line 120 in completion/services.py

View check run for this annotation

Codecov / codecov/patch

completion/services.py#L120

Added line #L120 was not covered by tests

# this is temporary local logic and will be removed when the whole course tree is included in completion
child_locations = [child.scope_ids.usage_id for child in self.get_completable_children(item)]
child_locations = [
child.scope_ids.usage_id for child in self.get_completable_children(item)
# for non-optional verticals, only include non-optional children
if optional_vertical or not getattr(child, "optional_content", False)
]
completions = self.get_completions(child_locations)
for child_location in child_locations:
if completions[child_location] < 1.0:
Expand Down

0 comments on commit 51c5c24

Please sign in to comment.