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

feat: ability to include unlisted courses in catalogs #767

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

johnnagro
Copy link
Contributor

@johnnagro johnnagro commented Feb 8, 2024

Description

  • introduces a new catalog query parameter enterprise_force_include_aggregation_keys
  • when a catalog's metadata is downloaded, we include the courseware in addition to whatever the query provides
  • discovery ignores keys it doesn't understand
  • force-included keys will be added and transformed to appear published and available in the enterprise catalog service
  • courses are marked with a magic key
  • https://2u-internal.atlassian.net/browse/ENT-8212

Todo

  • we may need additional metadata transformers, such as enrollment start date

@johnnagro johnnagro marked this pull request as draft February 8, 2024 21:11
@johnnagro johnnagro force-pushed the johnnagro/ENT-8212/0 branch 3 times, most recently from e1e75c5 to a025c53 Compare February 12, 2024 18:00
@johnnagro johnnagro force-pushed the johnnagro/ENT-8212/0 branch from a025c53 to 2f22378 Compare February 12, 2024 18:19
@johnnagro johnnagro marked this pull request as ready for review February 12, 2024 18:19
courses.extend(discovery_client.get_courses(query_params=query_params))

return courses
return DiscoveryApiClient().fetch_courses_by_keys(course_keys)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this logic into the client, left the old signature to maintain tests

programs.extend(discovery_client.get_programs(query_params=query_params))

return programs
return DiscoveryApiClient().fetch_programs_by_keys(program_keys)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this logic into the client, left the old signature to maintain tests

@@ -394,6 +376,10 @@ def _update_full_content_metadata_course(content_keys):
metadata_record.json_metadata['reviews_count'] = review.get('reviews_count')
metadata_record.json_metadata['avg_course_rating'] = review.get('avg_course_rating')

# johnnagro ENT-8212 need to retransform after full pull
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we initially force-include the content, we need to mark it somehow so that the "full content metadata update job" knows to re-transform it on the full content metadata object it retrieves after the initial catalog crawl

@@ -326,6 +346,48 @@ def get_programs(self, query_params=None):

return programs

def fetch_courses_by_keys(self, course_keys):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from tasks.py


return courses

def fetch_programs_by_keys(self, program_keys):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from tasks.py

@@ -102,6 +102,8 @@
'Certificación Profesional': 'Certificación Profesional',
}

FORCE_INCLUSION_METADATA_TAG_KEY = 'enterprise_force_included'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic field which marks content metadata as having been force-included

@@ -394,6 +376,10 @@ def _update_full_content_metadata_course(content_keys):
metadata_record.json_metadata['reviews_count'] = review.get('reviews_count')
metadata_record.json_metadata['avg_course_rating'] = review.get('avg_course_rating')

# johnnagro ENT-8212 need to retransform after full pull
if metadata_record.json_metadata.get(FORCE_INCLUSION_METADATA_TAG_KEY):
metadata_record.json_metadata = transform_course_metadata_to_visible(metadata_record.json_metadata)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably do want to add/update a test to cover this line.

@johnnagro johnnagro merged commit ff99ce6 into master Feb 12, 2024
5 of 6 checks passed
@johnnagro johnnagro deleted the johnnagro/ENT-8212/0 branch February 12, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants