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: synchronize restricted courses from discovery #973

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

iloveagent57
Copy link
Contributor

https://2u-internal.atlassian.net/browse/ENT-9570
This is one of two PRs required for the ticket. In this one, we'll deal only with synchronizing top-level restricted courses.

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-courses branch from 976fdf3 to 95decdb Compare October 11, 2024 18:52
Comment on lines +847 to +853
defaults={
'_json_metadata': course_metadata_dict,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we just overwrite _json_metadata instead of deferring to the existing one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what defaults does for update_or_create (and why"defaults" is a poorly-named keyward arg):

The update_or_create method tries to fetch an object from database based on the given kwargs. If a match is found, it updates the fields passed in the defaults dictionary.
https://docs.djangoproject.com/en/4.2/ref/models/querysets/#update-or-create

Copy link
Contributor

Choose a reason for hiding this comment

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

:shriek: I fear I've been misusing update_or_create for years now...

Copy link
Contributor

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

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

Looks good so far!

@iloveagent57 iloveagent57 force-pushed the aed/sync-restricted-courses branch 5 times, most recently from cd2b1c1 to 50210b6 Compare October 15, 2024 16:16
@iloveagent57 iloveagent57 force-pushed the aed/sync-restricted-courses branch from 50210b6 to bd8a35f Compare October 15, 2024 16:23
Copy link
Contributor

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

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

LGTM!

@iloveagent57 iloveagent57 merged commit 59f776b into master Oct 15, 2024
4 checks passed
@iloveagent57 iloveagent57 deleted the aed/sync-restricted-courses branch October 15, 2024 19:25
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