-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: adds sortable fields to studio content search index [FC-0059] #35103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf9ab01
5f71cc3
b8bf0bb
b7f8f8e
ecf0765
74a7ac8
224ec03
0ffd91e
cc67395
c1f7b05
ceaf314
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,7 +194,10 @@ class LibraryXBlockMetadata: | |
Class that represents the metadata about an XBlock in a content library. | ||
""" | ||
usage_key = attr.ib(type=LibraryUsageLocatorV2) | ||
created = attr.ib(type=datetime) | ||
modified = attr.ib(type=datetime) | ||
display_name = attr.ib("") | ||
last_published = attr.ib(default=None, type=datetime) | ||
has_unpublished_changes = attr.ib(False) | ||
tags_count = attr.ib(0) | ||
|
||
|
@@ -203,13 +206,18 @@ def from_component(cls, library_key, component): | |
""" | ||
Construct a LibraryXBlockMetadata from a Component object. | ||
""" | ||
last_publish_log = authoring_api.get_last_publish(component.pk) | ||
|
||
return cls( | ||
usage_key=LibraryUsageLocatorV2( | ||
library_key, | ||
component.component_type.name, | ||
component.local_key, | ||
), | ||
display_name=component.versioning.draft.title, | ||
created=component.created, | ||
modified=component.versioning.draft.created, | ||
last_published=None if last_publish_log is None else last_publish_log.published_at, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @ormsbee 👋 However, there isn't a date available on the What would be the best way to address this issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cf #35195 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember if there's a good helper for it at the moment, but I think you can get the datetime when a Component was published by following these relations: Component.publishable_entity -> PublishableEntity.published -> Published.publish_log_record -> PublishLogRecord.publish_log -> PublishLog. published_at |
||
has_unpublished_changes=component.versioning.has_unpublished_changes | ||
) | ||
|
||
|
@@ -660,13 +668,11 @@ def get_library_block(usage_key) -> LibraryXBlockMetadata: | |
if not draft_version: | ||
raise ContentLibraryBlockNotFound(usage_key) | ||
|
||
published_version = component.versioning.published | ||
|
||
return LibraryXBlockMetadata( | ||
usage_key=usage_key, | ||
display_name=draft_version.title, | ||
has_unpublished_changes=(draft_version != published_version), | ||
xblock_metadata = LibraryXBlockMetadata.from_component( | ||
library_key=usage_key.context_key, | ||
component=component, | ||
) | ||
return xblock_metadata | ||
|
||
|
||
def set_library_block_olx(usage_key, new_olx_str): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -441,7 +441,7 @@ def test_build_library_object_tree(self) -> None: | |
""" | ||
Test if we can export a library | ||
""" | ||
with self.assertNumQueries(8): | ||
with self.assertNumQueries(11): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My initial changes to Using Welcome any advice on how to avoid the increased query count here! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like an @ormsbee question if I'm correctly understanding that it's about efficiently fetching modified dates from learning core's |
||
tagged_library = build_object_tree_with_objecttags(self.library.key, self.all_library_object_tags) | ||
|
||
assert tagged_library == self.expected_library_tagged_xblock | ||
|
Uh oh!
There was an error while loading. Please reload this page.