Background
The Growth team is going to work on mentor dashboard (see T278920: Mentor dashboard: V1 desktop). As part of this dashboard, we will need to have a way to provide required data about mentor's mentee, so we can feed the dashboard with data.
Task objective
Create a maintenance script that will:
- Determine mentees that will be covered in the mentor overview. That means (copied from T278971):
- All mentees mentored by a given mentor, minus:
- Bot accounts
- Indefinitely blocked accounts
- Mentees who registered at least 2 weeks ago, and have 0 edits
- Mentees who did not make any edit in the last 6 months
- Delete rows from growthexperiments_mentee_data for all users that will not be covered by the mentor overview module
- For each covered mentee, calculate:
- Number of reverted edits
- Number of blocks the mentee received
- Number of mentorship questions the mentee asked
- Number of total edits made by the mentee (user_editcount)
- Registration timestamp (user_registration)
- Insert all data to growthexperiments_mentee_data encoded in a JSON blob
Example blob:
{ "reverted": 123, "blocks": 0, "questions": 4, "editcount": 1000, "user_registration": "20200413130400" }
The data stored in the database table will be calculated via MentorDataUncachedProvider (which will talk to the real databases) and accessed via MentorDataProvider, that will talk only to the caching table.