Page MenuHomePhabricator

Assign backup mentors to users
Closed, ResolvedPublic

Description

The T280307: Mentor dashboard: M2 mentor tools/settings part of the mentor dashboard will allow mentors to set themselves as away. This will result in questions asked by their mentees being sent to a backup mentor for the duration of their away-ness. This means we need to assign backup mentors to the users as well.

Thanks to mentor/mentee relationship now being stored in a DB table, which has column to indicate mentor's role, this should be just a matter of changing the mentor manager and relevant hooks to account for different kind of mentors.

Plan
  1. Require all callers of MentorStore::loadMentorUser() and MentorStore::setMentorForUser() to pass a valid mentor role. This will make the code more understandable. Currently, the default is to use ROLE_PRIMARY.
  2. Add backup mentor logic to the MentorManager
  3. Assign backup mentors to new users from MentorHooks

We do not need to care about existing users, as MentorManager will assign a backup mentor to them on-the-fly.

Event Timeline

Change 721981 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] MentorStore: Deprecate calling loadMentorUser/setMentorForUser with no role

https://gerrit.wikimedia.org/r/721981

Change 721982 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] Explicitly pass mentor role to callers of MentorStore's set/get functions

https://gerrit.wikimedia.org/r/721982

Change 721981 abandoned by Urbanecm:

[mediawiki/extensions/GrowthExperiments@master] MentorStore: Deprecate calling loadMentorUser/setMentorForUser with no role

Reason:

merged into 721982

https://gerrit.wikimedia.org/r/721981

Change 721983 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] Mentee overview: Only include mentor's primary mentees

https://gerrit.wikimedia.org/r/721983

Change 721985 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] MentorManager: Add logic for backup mentor

https://gerrit.wikimedia.org/r/721985

Change 721983 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Mentee overview: Only include mentor's primary mentees

https://gerrit.wikimedia.org/r/721983

Change 721982 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Explicitly pass role to callers of MentorStore's set/get functions

https://gerrit.wikimedia.org/r/721982

Change 722862 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] WIP: For away mentors, direct questions to a replacement one

https://gerrit.wikimedia.org/r/722862

Change 721985 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] MentorManager: Add logic for backup mentor

https://gerrit.wikimedia.org/r/721985

Change 722862 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] For away mentors, direct their questions to a backup mentor

https://gerrit.wikimedia.org/r/722862

Backup mentors are now a thing:

mysql:research@dbstore1005.eqiad.wmnet [enwiki]> select gemm_mentor_role, count(*) from growthexperiments_mentor_mentee group by gemm_mentor_role;
+------------------+----------+
| gemm_mentor_role | count(*) |
+------------------+----------+
| backup           |     3265 |
| primary          |   641180 |
+------------------+----------+
2 rows in set (0.348 sec)

mysql:research@dbstore1005.eqiad.wmnet [enwiki]> use cswiki;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql:research@dbstore1005.eqiad.wmnet [cswiki]> select gemm_mentor_role, count(*) from growthexperiments_mentor_mentee group by gemm_mentor_role;
+------------------+----------+
| gemm_mentor_role | count(*) |
+------------------+----------+
| backup           |       53 |
| primary          |    33003 |
+------------------+----------+
2 rows in set (0.029 sec)

I also ensured a backup mentor relationship gets assigned when the primary one is set to away.