Skip to content

Commit e76cb17

Browse files
committed
feat: add version_num to LibraryXBlockMetadata
1 parent 57d066f commit e76cb17

File tree

1 file changed

+4
-1
lines changed
  • openedx/core/djangoapps/content_libraries

1 file changed

+4
-1
lines changed

openedx/core/djangoapps/content_libraries/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class LibraryXBlockMetadata:
194194
Class that represents the metadata about an XBlock in a content library.
195195
"""
196196
usage_key = attr.ib(type=LibraryUsageLocatorV2)
197+
version_num = attr.ib(type=int)
197198
display_name = attr.ib("")
198199
has_unpublished_changes = attr.ib(False)
199200
tags_count = attr.ib(0)
@@ -210,7 +211,8 @@ def from_component(cls, library_key, component):
210211
component.local_key,
211212
),
212213
display_name=component.versioning.draft.title,
213-
has_unpublished_changes=component.versioning.has_unpublished_changes
214+
has_unpublished_changes=component.versioning.has_unpublished_changes,
215+
version_num=component.versioning.draft.version_num,
214216
)
215217

216218

@@ -651,6 +653,7 @@ def get_library_block(usage_key) -> LibraryXBlockMetadata:
651653
usage_key=usage_key,
652654
display_name=draft_version.title,
653655
has_unpublished_changes=(draft_version != published_version),
656+
version_num=draft_version.version_num,
654657
)
655658

656659

0 commit comments

Comments
 (0)