Closed gabina closed 1 week ago
RevisionScoreImporter specs are failing, I think I understand why. Will fix it on Monday.
The following specs are failing but they're not related to my changes. I think both specs were already fixed in master. I'll sync my own data-rearchitecture-for-dashboard
branch with master in a next PR.
rspec ./spec/lib/replica_spec.rb:151 # Replica API requests functions identically on non-English wikis
rspec ./spec/lib/replica_spec.rb:98 # Replica API requests Article retrieval when fetching existing articles returns article "Autism"
What this PR does
This PR makes a small proof of concept for the data re-architecture project. Basically:
RevisionDataManager
class that given a course, a wiki and a specific period of time (in the future, a timeslice), it fetches revision and revision scores from different APIs, and returns an array with all that data.RevisionDataManager
class:UpdateCourseStatsTimeslice
class that updates timeslices from this revision data in RAM (not commited yet).update_cache_from_revisions
method for theArticleCourseTimeslice
, which updates anArticleCourseTimeslice
record with the new revisions in memory.update_cache
method for theArticleCourse
, to update caches based on theArticleCourseTimeslice
records instead of the revision table (ArticlesCourses.update_cache_from_timeslices
).This PR adds specs for all the new behaviors.
Open questions and concerns
There are a lot of TODO comments that will be handled in the future. A similar process should be done for
CourseWikiTimeslice
andCourseUserWikiTimeslice
timeslices.For
ArticlesCourses
records, nowview_count
is calculated based on the first non-empty article course timeslice recordstart
date (instead of using the first revision). We estimate the first non-empty record checkinguser_ids
field is not null. This should lead to the same results.