Skip to content

Commit

Permalink
feat: add version_num to LibraryXBlockMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmccormick committed Jul 17, 2024
1 parent c7f2f0e commit 2cd7f75
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openedx/core/djangoapps/content_libraries/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class LibraryXBlockMetadata:
Class that represents the metadata about an XBlock in a content library.
"""
usage_key = attr.ib(type=LibraryUsageLocatorV2)
version_num = attr.ib(type=int)
display_name = attr.ib("")
has_unpublished_changes = attr.ib(False)
tags_count = attr.ib(0)
Expand All @@ -210,7 +211,8 @@ def from_component(cls, library_key, component):
component.local_key,
),
display_name=component.versioning.draft.title,
has_unpublished_changes=component.versioning.has_unpublished_changes
has_unpublished_changes=component.versioning.has_unpublished_changes,
version_num=component.versioning.draft.version_num,
)


Expand Down Expand Up @@ -666,6 +668,7 @@ def get_library_block(usage_key) -> LibraryXBlockMetadata:
usage_key=usage_key,
display_name=draft_version.title,
has_unpublished_changes=(draft_version != published_version),
version_num=draft_version.version_num,
)


Expand Down

0 comments on commit 2cd7f75

Please sign in to comment.