Skip to content

Commit

Permalink
feat: following on
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnagro committed Feb 12, 2024
1 parent ff99ce6 commit ec6da59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions enterprise_catalog/apps/api_client/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ def get_metadata_by_query(self, catalog_query):
try:
# NOTE johnnagro this ONLY supports courses at the moment (NOT programs, leanerpathways, etc)
if forced_aggregation_keys := catalog_query.content_filter.get('enterprise_force_include_aggregation_keys'):
LOGGER.info(

Check warning on line 224 in enterprise_catalog/apps/api_client/discovery.py

View check run for this annotation

Codecov / codecov/patch

enterprise_catalog/apps/api_client/discovery.py#L224

Added line #L224 was not covered by tests
'get_metadata_by_query enterprise_force_include_aggregation_keys seen'
f'attempting to force-include: {forced_aggregation_keys}'
)
forced_courses = self.fetch_courses_by_keys(forced_aggregation_keys)
results += tansform_force_included_courses(forced_courses)
except Exception as exc:
Expand Down
8 changes: 7 additions & 1 deletion enterprise_catalog/apps/catalog/content_metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from logging import getLogger

from enterprise_catalog.apps.catalog.utils import get_content_key

from .constants import FORCE_INCLUSION_METADATA_TAG_KEY


Expand All @@ -17,7 +19,7 @@ def tansform_force_included_courses(courses):
"""
results = []
for course_metadata in courses:
results += transform_course_metadata_to_visible(course_metadata)
results.append(transform_course_metadata_to_visible(course_metadata))
return results


Expand All @@ -27,6 +29,10 @@ def transform_course_metadata_to_visible(course_metadata):
so that it is visible/available/published in our metadata
ENT-8212
"""
content_key = get_content_key(course_metadata)
LOGGER.info(
f'transform_course_metadata_to_visible on content_key: {content_key}'
)
course_metadata[FORCE_INCLUSION_METADATA_TAG_KEY] = True
advertised_course_run_uuid = course_metadata.get('advertised_course_run_uuid')
course_run_statuses = []
Expand Down

0 comments on commit ec6da59

Please sign in to comment.