Implement error logging in update_average_pageviews method in UpdateCourseStats #6023
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses issue #4340 by extending error logging during the average pageviews update process in the
UpdateCourseStats service
. The methodupdate_average_pageviews
now includes theupdate_service
parameter when callingAverageViewsImporter.update_outdated_average_views
, allowing for improved tracking of errors and Sentry IDs during the course data update process.I have implemented an isolated test (
update_course_stats_average_views_importer_spec.rb
) for theupdate_average_pageviews
method within the UpdateCourseStats class. The test validates two main functionalities:-Updating Outdated Average Views: The test ensures that the
AverageViewsImporter.update_outdated_average_views
method is called with the correct parameters, specifically checking that it receives the list of articles associated with the course and theupdate_service
instance.-Logging Progress: The test verifies that the progress of updating average pageviews is logged correctly. This includes checking that the
log_update_progress
method is invoked with the expected symbol:average_pageviews_updated
.