enterprise-catalog
enterprise-catalog copied to clipboard
feat: fetch and filter out restricted course runs
- When enabled, fetches restricted b2b runs during syncing of full course metadata from discovery.
- Subsequently prevents restricted runs from being written to ContentMetadata.json_metadata before saving.
- In a future PR, we'll make use of the pruned restricted runs on a per-customer-catalog fashion.
Local Testing
Set up a restricted course run locally
It'll be associated with DemoX: https://2u-internal.atlassian.net/wiki/spaces/SOL/pages/1317306375/Setting+up+restricted+runs+locally
Enable the setting
In your private.py
settings file, set SHOULD_FETCH_RESTRICTED_COURSE_RUNS = True
Sync full course metadata
-
make worker-restart worker-logs
- In a different shell, do
make app-shell
and then./manage.py update_full_content_metadata --force
- Observe in the worker logs a line like
[restricted runs] Course edX+DemoX has restricted runs {'course-v1:edX+DemoX+restricted_run'} that will be removed.
Verify non-presence of restricted run in API
Fetch content metadata for the DemoX course in enterprise-catalog, i.e.
curl --location 'http://localhost:18160/api/v1/enterprise-catalogs/7467c9d2-433c-4f7e-ba2e-c5c7798527b2/get_content_metadata/?content_keys=edX%2BDemoX&traverse_pagination=True' \
--header 'Authorization: JWT [your jwt]' \
Observe that the restricted run is not included in the payload.
ENT-9404
Post-review
- [ ] Squash commits into discrete sets of changes
- [ ] Ensure that once the changes have been deployed to stage, prod is manually deployed