-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: use course-run specific metadata #633
Conversation
e756cd9
to
e4170b2
Compare
e4170b2
to
4e6a658
Compare
enterprise_access/utils.py
Outdated
for course_run in course_runs: | ||
if course_run.get('key') == preferred_course_run_key: |
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.
nit: could opt to use next
to extract the desired course run, if you wanted. might be a bit more "pythonic", e.g.:
course_run = next((run for run in course_runs if run.get('key') == preferred_course_run_key), None)
if not course_run:
logger.warning(
'Course run metadata not found for preferred course run key %s in content metadata %s',
preferred_course_run_key,
content_metadata.get('key'),
)
return course_run
(Opted to add logging when the preferred_course_run_key
is not found in the list of course_runs
).
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.
Great job with the abstraction with a few suggestions.
f3cf90f
to
eeb5bfc
Compare
eeb5bfc
to
6edc5fa
Compare
Hey @brobro10000 @adamstankiewicz , thanks for the awesome insights! ❤️ I've resolved the comments I was sure about and left the rest for you folks to review. |
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.
There is one final optimization that can be included to avoid a potential None value return for content metadata.
4023cf9
to
75845fb
Compare
75845fb
to
6993ab3
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.
Great job 👍🏽
Description:
Add a description of your changes here.
Jira:
ENT-9890
Merge checklist:
./manage.py makemigrations
has been runPost merge: