Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/content/search/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def index_collection_batch(batch, num_done, library_key) -> int:

# To reduce memory usage on large instances, split up the Collections into pages of 100 collections:
library = lib_api.get_library(lib_key)
collections = authoring_api.get_collections(library.learning_package.id, enabled=True)
collections = authoring_api.get_collections(library.learning_package_id, enabled=True)
num_collections = collections.count()
num_collections_done = 0
status_cb(f"{num_collections_done + 1}/{num_collections}. Now indexing collections in library {lib_key}")
Expand Down Expand Up @@ -711,7 +711,7 @@ def update_library_components_collections(
Because there may be a lot of components, we send these updates to Meilisearch in batches.
"""
library = lib_api.get_library(library_key)
components = authoring_api.get_collection_components(library.learning_package.id, collection_key)
components = authoring_api.get_collection_components(library.learning_package_id, collection_key)

paginator = Paginator(components, batch_size)
for page in paginator.page_range:
Expand Down
19 changes: 9 additions & 10 deletions openedx/core/djangoapps/content/search/tests/test_documents.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Tests for the Studio content search documents (what gets stored in the index)
"""
from dataclasses import replace
from datetime import datetime, timezone
from organizations.models import Organization

Expand Down Expand Up @@ -427,18 +428,16 @@ def test_html_published_library_block(self):
}

# Verify publish status is set to modified
old_modified = self.library_block.modified
old_published = self.library_block.last_published
self.library_block.modified = datetime(2024, 4, 5, 6, 7, 8, tzinfo=timezone.utc)
self.library_block.last_published = datetime(2023, 4, 5, 6, 7, 8, tzinfo=timezone.utc)
doc = searchable_doc_for_library_block(self.library_block)
doc.update(searchable_doc_tags(self.library_block.usage_key))
doc.update(searchable_doc_collections(self.library_block.usage_key))
library_block_modified = replace(
self.library_block,
modified=datetime(2024, 4, 5, 6, 7, 8, tzinfo=timezone.utc),
last_published=datetime(2023, 4, 5, 6, 7, 8, tzinfo=timezone.utc),
)
doc = searchable_doc_for_library_block(library_block_modified)
doc.update(searchable_doc_tags(library_block_modified.usage_key))
doc.update(searchable_doc_collections(library_block_modified.usage_key))
assert doc["publish_status"] == "modified"

self.library_block.modified = old_modified
self.library_block.last_published = old_published

def test_collection_with_library(self):
doc = searchable_doc_for_collection(self.library.key, self.collection.key)
doc.update(searchable_doc_tags_for_collection(self.library.key, self.collection.key))
Expand Down
Loading
Loading