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: fetch and filter out restricted course runs #939

Closed
wants to merge 1 commit into from

Conversation

iloveagent57
Copy link
Contributor

@iloveagent57 iloveagent57 commented Sep 9, 2024

  • 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

  1. make worker-restart worker-logs
  2. In a different shell, do make app-shell and then ./manage.py update_full_content_metadata --force
  3. 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

@iloveagent57 iloveagent57 force-pushed the aed/include-restricted-toggle branch 7 times, most recently from 369b97b to 8043576 Compare September 10, 2024 15:27
@pwnage101
Copy link
Contributor

The rest LGTM!

@pwnage101
Copy link
Contributor

Hm, in the process of drafting an approach for ENT-9405 (draft PR: #947) it occurs to me that this current PR likely does not actually store restricted runs into the database as "orphan" ContentMetadata records because it only updates the call to /courses to get the full metadata, but an update to the /search/all call is missing.

We definitely need both to be updated, so the changes in this PR are still necessary, but just FYI my PR introduces new API calls to fetch the restricted runs from /search/all and stores them as ContentMetadata records. Just so you know so we don't step over toes!

@iloveagent57 iloveagent57 force-pushed the aed/include-restricted-toggle branch 4 times, most recently from b90bf77 to c98b372 Compare September 23, 2024 19:55
* 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.
ENT-9404
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