In order to allow others to act on behalf of Judges, add clear roles to members of Judge Teams.
organizations_users table has a column judge_team_role, valid values of nil, judge, and attorneyThis ticket _does not_ include updating the code base to do anything with these fields, nor updating the existing teams.
Part of #11801
Estimating at 1.
@lomky Love this idea! Super pumped to stop overloading the admin column for JudgeTeams!
How do you feel about moving the new judge_team_role column into a different table since it will only apply to judge teams? That field will only have values for OrganzationUsers associated with JudgeTeams and right now less than a third of the rows in that table are associated with JudgeTeams. That proportion will likely decrease over time since we will add more teams and organizations, and judges and attorneys are already well populated in that table.
rails c> OrganizationsUser.count
# 3144
rails c> OrganizationsUser.where(organization_id: JudgeTeam.pluck(:id)).count
# 954
What do you think of a table definition that looks like the following:
judge_team_users (
organziations_users_id int -- could instead use organization and user IDs
role enum(judge, attorney)
)
Some advantages to this approach include:
null roles. If a user is in a judge team they will have a role.OrganizationsUser are relevant to all rows. Currently there are only three columns in this table that are not used for linking the user and the organization. created_at and updated_at provide timestamps and admin is a boolean which describes whether someone is has administrative privileges or not. All organizations make use of administrative privileges in some way (user management), so this applies to all rows in the table.We're going to proceed as follows:
JudgeTeamRole single-table inheritance models (slightly modified approach described above) (#12449).judge_team_roles table.JudgeTeams have only one User with the JudgeTeamLead role.JudgeTeamLeads are always identified as admins in the associated OrganizationsUser model.JudgeTeamRoles should exist. (#12421)JudgeTeamRoles (#12422)@lowellrex number 3 is a follow-on ticket, as well. #12421
Closing this ticket since all remaining work will happen in #12481, #12421, and #12422.
Most helpful comment
@lomky Love this idea! Super pumped to stop overloading the
admincolumn forJudgeTeams!How do you feel about moving the new
judge_team_rolecolumn into a different table since it will only apply to judge teams? That field will only have values forOrganzationUsers associated withJudgeTeams and right now less than a third of the rows in that table are associated withJudgeTeams. That proportion will likely decrease over time since we will add more teams and organizations, and judges and attorneys are already well populated in that table.What do you think of a table definition that looks like the following:
Some advantages to this approach include:
nullroles. If a user is in a judge team they will have a role.OrganizationsUserare relevant to all rows. Currently there are only three columns in this table that are not used for linking the user and the organization.created_atandupdated_atprovide timestamps andadminis a boolean which describes whether someone is has administrative privileges or not. All organizations make use of administrative privileges in some way (user management), so this applies to all rows in the table.