Skip to content
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

Revert "feat: ENT-7554 Added academies in Algolia index" #715

Merged
merged 1 commit into from
Nov 14, 2023
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
Empty file.
38 changes: 0 additions & 38 deletions enterprise_catalog/apps/academy/tests/factories.py

This file was deleted.

23 changes: 0 additions & 23 deletions enterprise_catalog/apps/api/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ def add_metadata_to_algolia_objects(
catalog_uuids,
customer_uuids,
catalog_queries,
academy_uuids,
):
"""
Convert ContentMetadata objects into Algolia products and accumulate results into `algolia_products_by_object_id`.
Expand Down Expand Up @@ -677,16 +676,6 @@ def add_metadata_to_algolia_objects(
)
_add_in_algolia_products_by_object_id(algolia_products_by_object_id, batched_metadata)

# academy uuids
academy_uuids = sorted(list(academy_uuids))
batched_metadata = _batched_metadata(
json_metadata,
academy_uuids,
'academy_uuids',
'{}-academy-uuids-{}',
)
_add_in_algolia_products_by_object_id(algolia_products_by_object_id, batched_metadata)

# enterprise catalog queries (tuples of (query uuid, query title)), note: account for None being present
# within the list
queries = sorted(list(catalog_queries))
Expand Down Expand Up @@ -748,11 +737,9 @@ def _get_algolia_products_for_batch(
catalog_uuids_by_key = defaultdict(set)
customer_uuids_by_key = defaultdict(set)
catalog_queries_by_key = defaultdict(set)
academy_uuids_by_key = defaultdict(set)

catalog_query_uuid_by_catalog_uuid = defaultdict(set)
customer_uuid_by_catalog_uuid = defaultdict(set)
academy_uuids_by_catalog_uuid = defaultdict(set)

# Create a shared convenience queryset to prefetch catalogs for all metadata lookups below.
all_catalog_queries = CatalogQuery.objects.prefetch_related('enterprise_catalogs')
Expand Down Expand Up @@ -819,10 +806,6 @@ def _get_algolia_products_for_batch(
# Cache UUIDs related to each catalog.
catalog_query_uuid_by_catalog_uuid[str(catalog.uuid)] = (str(catalog_query.uuid), catalog_query.title)
customer_uuid_by_catalog_uuid[str(catalog.uuid)] = str(catalog.enterprise_uuid)
associated_academies = catalog.academies.all()
for academy in associated_academies:
academy_uuids_by_key[content_key].add(str(academy.uuid))
academy_uuids_by_catalog_uuid[str(catalog.uuid)].add(str(academy.uuid))

# Second pass. This time the goal is to capture indirect relationships on programs:
# * For each program:
Expand Down Expand Up @@ -850,10 +833,6 @@ def _get_algolia_products_for_batch(
customer_uuids_by_key[program_content_key].update(
customer_uuid_by_catalog_uuid[catalog_uuid] for catalog_uuid in common_catalogs
)
for catalog_uuid in common_catalogs:
academy_uuids_by_key[program_content_key].update(
academy_uuids_by_catalog_uuid[catalog_uuid]
)

# Third pass. This time the goal is to capture indirect relationships on pathways:
# * For each pathway:
Expand All @@ -868,7 +847,6 @@ def _get_algolia_products_for_batch(
catalog_queries_by_key[pathway_content_key].update(catalog_queries_by_key[metadata.content_key])
catalog_uuids_by_key[pathway_content_key].update(catalog_uuids_by_key[metadata.content_key])
customer_uuids_by_key[pathway_content_key].update(customer_uuids_by_key[metadata.content_key])
academy_uuids_by_key[pathway_content_key].update(academy_uuids_by_key[metadata.content_key])

# Extra disabled logic to additionally absorb UUIDs from courses linked to this pathway indirectly via a
# program (chain of association is course -> program -> pathway). This doesn't work because
Expand Down Expand Up @@ -903,7 +881,6 @@ def _get_algolia_products_for_batch(
catalog_uuids_by_key[metadata.content_key],
customer_uuids_by_key[metadata.content_key],
catalog_queries_by_key[metadata.content_key],
academy_uuids_by_key[metadata.content_key],
)

num_content_metadata_indexed += 1
Expand Down
Loading
Loading