From 5e1ca9c857ee97e902621f2b48f9daac89907836 Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Tue, 25 Jun 2024 17:56:19 -0400 Subject: [PATCH] feat: add version_num to LibraryXBlockMetadata --- openedx/core/djangoapps/content_libraries/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/content_libraries/api.py b/openedx/core/djangoapps/content_libraries/api.py index 82d648eaeba1..c84f2e91dfde 100644 --- a/openedx/core/djangoapps/content_libraries/api.py +++ b/openedx/core/djangoapps/content_libraries/api.py @@ -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) @@ -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, ) @@ -651,6 +653,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, )