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: adding course review metrics to content metadata and algolia index #735

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

alex-sheehan-edx
Copy link
Contributor

Ticket Link

Link to the associated ticket
https://2u-internal.atlassian.net/browse/ENT-8126

Post-review

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

@alex-sheehan-edx alex-sheehan-edx marked this pull request as draft December 20, 2023 22:16
@alex-sheehan-edx alex-sheehan-edx force-pushed the asheehan-edx/ENT-8126-course-reviews branch 2 times, most recently from 12106bf to 2450c9e Compare December 21, 2023 17:38
@alex-sheehan-edx alex-sheehan-edx marked this pull request as ready for review January 3, 2024 15:47
@alex-sheehan-edx alex-sheehan-edx force-pushed the asheehan-edx/ENT-8126-course-reviews branch 8 times, most recently from 7fbd4a3 to 3633ef5 Compare January 4, 2024 18:42
Copy link
Contributor

@kiram15 kiram15 left a comment

Choose a reason for hiding this comment

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

LGTM once tests pass! 🚢

with self.assertRaises(requests.exceptions.RequestException):
client._retrieve_course_reviews(request_params)

assert 'Retrieving course reviews from course-discovery for page 1...' in mock_logger.info.call_args.args[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

asserting log lines is less preferable than asserting the mocks are called with a specific input or some outcome/side-effect is observed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed for a mock called assertion

@@ -80,6 +81,75 @@ def _retrieve_metadata_for_content_filter(self, content_filter, page, request_pa
break
return response.json()

def _retrieve_course_reviews(self, request_params):
"""
Makes a request to discovery's /api/v1/course_review/ paginated endpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

is this endpoint paginated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

locally testing it seems so?

if run.get('uuid') == course_run_uuid:
run.update({'start': start_date, 'end': end_date})

# Perform more steps to normalize and move keys around for more consistency across content types.
_normalize_course_metadata(metadata_record)

if review := reviews_for_courses_dict.get(content_key):
Copy link
Contributor

Choose a reason for hiding this comment

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

reviews_for_courses_dict is a list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope- get_course_reviews should return a dictionary

@alex-sheehan-edx alex-sheehan-edx force-pushed the asheehan-edx/ENT-8126-course-reviews branch 2 times, most recently from 00643ed to 04457f3 Compare January 4, 2024 21:09
@alex-sheehan-edx alex-sheehan-edx force-pushed the asheehan-edx/ENT-8126-course-reviews branch from 04457f3 to 21d6c12 Compare January 4, 2024 21:18
@alex-sheehan-edx alex-sheehan-edx merged commit 3f1fbe8 into master Jan 5, 2024
6 checks passed
@alex-sheehan-edx alex-sheehan-edx deleted the asheehan-edx/ENT-8126-course-reviews branch January 5, 2024 16:13
irfanuddinahmad pushed a commit that referenced this pull request Jul 24, 2024
…iews

feat: adding course review metrics to content metadata and algolia index
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.

3 participants