WikiEducationFoundation / WikiEduDashboard

Wiki Education Foundation's Wikipedia course dashboard system
https://dashboard.wikiedu.org
MIT License
392 stars 631 forks source link

Implement error logging in update_average_pageviews method in UpdateCourseStats #6023

Open arafats1 opened 3 weeks ago

arafats1 commented 3 weeks ago

This PR addresses issue #4340 by extending error logging during the average pageviews update process in the UpdateCourseStats service. The method update_average_pageviews now includes the update_service parameter when calling AverageViewsImporter.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 the update_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 the update_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.

image

arafats1 commented 3 weeks ago

Hi @ragesoss

Could you kindly take a look at my PR? Thanks