-
Notifications
You must be signed in to change notification settings - Fork 19
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: sync full metadata for restricted courses #985
Conversation
73cd033
to
f92b203
Compare
program_content_keys = create_course_associated_programs( | ||
course_metadata_dict.get('programs', []), | ||
metadata_record, | ||
) | ||
_update_full_content_metadata_program(program_content_keys, dry_run) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only change here was yanking this out of _update_single_full_course_record()
and into the calling function, to better isolate responsibilities and avoid duplicate work.
d821a22
to
e04d0f1
Compare
operations = [ | ||
migrations.AddField( | ||
model_name='restrictedcoursemetadata', | ||
name='restricted_run_allowed_for_restricted_course', | ||
field=models.ManyToManyField(through='catalog.RestrictedRunAllowedForRestrictedCourse', to='catalog.contentmetadata'), | ||
), | ||
migrations.AlterField( | ||
model_name='restrictedrunallowedforrestrictedcourse', | ||
name='course', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='catalog.restrictedcoursemetadata'), | ||
), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a SQL no-op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me, left some nit-level comments to consider/clarify (have not tested locally).
c21303f
to
8c0daa7
Compare
Made some recent updates to this branch:
|
8c0daa7
to
1b33e17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
""" | ||
Given a fetched dictionary of course content metadata and an option `course_review` record, | ||
updates an existing course `ContentMetadata` instance with the "full" dictionary of `json_metadata` | ||
for that course. | ||
""" | ||
# Merge the full metadata from discovery's /api/v1/courses into the local metadata object. | ||
metadata_record._json_metadata.update(course_metadata_dict) # pylint: disable=protected-access | ||
if not skip_json_metadata_update: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
ENT-9597
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, setSHOULD_FETCH_RESTRICTED_COURSE_RUNS = True
. Optionally setSHOULD_INDEX_COURSES_WITH_RESTRICTED_RUNS = True
if you'd like to test against a dev algolia index, too.Sync full course metadata
make worker-restart worker-logs
make app-shell
and then./manage.py update_content_metadata --force
(note that this mgmt command runs both theupdate_catalog_metadata
task and theupdate_full_content_metadata_task
.)./manage.py reindex_algolia --force --no-async
Post-review