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: syncrhonize restricted course runs #977

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

iloveagent57
Copy link
Contributor

@iloveagent57 iloveagent57 commented Oct 17, 2024

ENT-9570
Updates or creates restricted course run metadata records when restricted courses are updated, and links the restricted run content to the restricted course. Note this makes additional call to discovery's search/all/ endpoint for restricted run metadata, one per query that allows restricted runs.

Post-review

  • Squash commits into discrete sets of changes
  • Ensure that once the changes have been deployed to stage, prod is manually deployed

@iloveagent57 iloveagent57 force-pushed the aed/sync-restricted-runs branch 3 times, most recently from abbb3db to c392ba7 Compare October 17, 2024 15:47
Comment on lines 904 to 915
@staticmethod
def allowed_runs_for_course(course_metadata_dict, catalog_query):
"""
Given a ``course_metadata_dict``, returns a filtered list of ``course_runs``
containing only unrestricted runs and restricted runs that are allowed by
the provided ``catalog_query``.
"""
allowed_restricted_runs = catalog_query.restricted_runs_allowed.get(course_metadata_dict['key'], [])
return [
run for run in course_metadata_dict['course_runs']
if run.get(COURSE_RUN_RESTRICTION_TYPE_KEY) is None or run['key'] in allowed_restricted_runs
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think this would be more self-documenting if it composed restricted_runs_for_course(), then simply appended all unrestricted runs.

@iloveagent57 iloveagent57 force-pushed the aed/sync-restricted-runs branch from c392ba7 to 23a80a6 Compare October 17, 2024 20:54
@iloveagent57 iloveagent57 merged commit 4b3954e into master Oct 18, 2024
4 checks passed
@iloveagent57 iloveagent57 deleted the aed/sync-restricted-runs branch October 18, 2024 13:11
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