-
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: include content_price
in Algolia indexed course_runs
for course objects
#943
Conversation
967b917
to
f362639
Compare
@@ -25,11 +25,15 @@ | |||
PAST_COURSE_RUN_UUID_1 = uuid4() | |||
|
|||
|
|||
def _fake_upgrade_deadline(days_from_now=0): | |||
def _days_from_now(days_from_now=0): |
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.
[inform] Rename carried over from #912
content_price
in Algolia indexed course_runs
for course objects
def course(self): | ||
return self.instance.get('course') | ||
def course_metadata(self): | ||
return self.instance.get('course_metadata') | ||
|
||
@cached_property | ||
def course_metadata(self): | ||
return self.course.json_metadata | ||
def is_exec_ed_2u_course(self): | ||
return self.course_metadata.get('course_type') == EXEC_ED_2U_COURSE_TYPE |
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.
[inform] To support using NormalizedContentMetadataSerializer
where only the metadata for course is available vs. the actual database ContentMetadata
object itself, consumers must pass in course_metadata: course_record.json_metadata
instead of having the serializer attempt to parse json_metadata
.
As a result, the helper property is_exec_ed_2u_course
that exists on the ContentMetadata
model is accounted for here as well such that the get_content_price
can still utilize it.
f362639
to
374dfb3
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 👍🏽
ENT-9504
course_runs
list indexed in Algolia course objects containscontent_price
.enroll_by
for the indexedcourse_runs
fromNormalizedContentMetadataSerializer
vs. largely replicating the same logic in multiple places (DRY).Post-review