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: include content_price in Algolia indexed course_runs for course objects #943

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Sep 16, 2024

ENT-9504

  • Ensures the course_runs list indexed in Algolia course objects contains content_price.
  • Refactors to pull enroll_by for the indexed course_runs from NormalizedContentMetadataSerializer vs. largely replicating the same logic in multiple places (DRY).

Post-review

  • Squash commits into discrete sets of changes
  • Ensure that once the changes have been deployed to stage, prod is manually deployed

@@ -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):
Copy link
Member Author

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

@adamstankiewicz adamstankiewicz changed the title feat: include content_price in indexed course_runs for course objects feat: include content_price in Algolia indexed course_runs for course objects Sep 16, 2024
Comment on lines -102 to +107
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
Copy link
Member Author

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.

Copy link
Member

@brobro10000 brobro10000 left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏽

@adamstankiewicz adamstankiewicz merged commit 444c967 into master Sep 16, 2024
4 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/run-based-content-price branch September 16, 2024 18:55
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