Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM: Migrate existing Judge Teams to use Judge & Attorney Roles #12421

Closed
2 tasks done
lomky opened this issue Oct 17, 2019 · 3 comments
Closed
2 tasks done

CM: Migrate existing Judge Teams to use Judge & Attorney Roles #12421

lomky opened this issue Oct 17, 2019 · 3 comments
Assignees

Comments

@lomky
Copy link
Contributor

lomky commented Oct 17, 2019

Followup to #12420 to update the existing JudgeTeams to mark their Judges & Attorneys before we add any new admins to teams.

Acceptance Criteria

  • Current JudgeTeam admins have the role JudgeTeamLead
  • Current JudgeTeam non-admins have the role DecisionDraftingAttorney

Part of #11801

@kevmo
Copy link
Contributor

kevmo commented Oct 18, 2019

Estimating at 2. Do as a Rake task.

@lomky lomky self-assigned this Nov 6, 2019
va-bot pushed a commit that referenced this issue Nov 8, 2019
…12636)

Connects #12421 

### Description
Creates a Rake task to process all the JudgeTeams and assign the Admin `JudgeTeamLead` and the nonadmins `DecisionDraftingAttorney`s. 

Will alert & not process empty judge teams, teams with no admin, teams with multiple admins.

## Test Plan
Rake task run on dev without any issues.

For production run, task should be run with `dry_run` and results reviewed before invoking final migration.

Ultimately we are populating a currently empty table with data, and no data is being deleted. Risk is low.
@lomky
Copy link
Contributor Author

lomky commented Nov 12, 2019

Dry run in production found a small bug with passing in an argument for an alert message.

Also discovered there are two extant judge teams with multiple admins already (!!). These two teams will not be affected by the rake task, and will be manually corrected instead as they are in what is currently considered a bad state.

Notes:

# Existing State for JudgeTeamLead & DecisionDraftingAttorney
irb(main):001:0> JudgeTeamLead.first
=> nil
# No JudgeTeamLeads
irb(main):007:0> DecisionDraftingAttorney.all       
=> #<ActiveRecord::Relation [#<DecisionDraftingAttorney id: 2, type: "DecisionDraftingAttorney", organizations_user_id: 5532, created_at: "2019-11-06 16:02:09", updated_at: "2019-11-06 16:02:09">, #<DecisionDraftingAttorney id: 3, type: "DecisionDraftingAttorney", organizations_user_id: 5533, created_at: "2019-11-06 16:02:23", updated_at: "2019-11-06 16:02:23">, #<DecisionDraftingAttorney id: 4, type: "DecisionDraftingAttorney", organizations_user_id: 5534, created_at: "2019-11-06 16:02:46", updated_at: "2019-11-06 16:02:46">, #<DecisionDraftingAttorney id: 5, type: "DecisionDraftingAttorney", organizations_user_id: 5535, created_at: "2019-11-06 16:02:58", updated_at: "2019-11-06 16:02:58">, #<DecisionDraftingAttorney id: 6, type: "DecisionDraftingAttorney", organizations_user_id: 5536, created_at: "2019-11-06 16:05:05", updated_at: "2019-11-06 16:05:05">, #<DecisionDraftingAttorney id: 7, type: "DecisionDraftingAttorney", organizations_user_id: 5552, created_at: "2019-11-07 19:53:03", updated_at: "2019-11-07 19:53:03">, #<DecisionDraftingAttorney id: 8, type: "DecisionDraftingAttorney", organizations_user_id: 5553, created_at: "2019-11-07 19:53:11", updated_at: "2019-11-07 19:53:11">, #<DecisionDraftingAttorney id: 9, type: "DecisionDraftingAttorney", organizations_user_id: 5554, created_at: "2019-11-07 19:53:18", updated_at: "2019-11-07 19:53:18">, #<DecisionDraftingAttorney id: 10, type: "DecisionDraftingAttorney", organizations_user_id: 5555, created_at: "2019-11-07 19:53:27", updated_at: "2019-11-07 19:53:27">]>
# 9 attorney roles

# Dry Run

# Bug: forgot to pass in judge_team for alerting
irb(main):009:0> AssignJudgeteamRoles.new.perform_dry_run
...
Traceback (most recent call last):
        6: from (irb):9
        5: from app/workflows/assign_judgeteam_roles.rb:9:in `perform_dry_run'
        4: from app/workflows/assign_judgeteam_roles.rb:13:in `process'
        3: from app/workflows/assign_judgeteam_roles.rb:19:in `block in process'
        2: from app/workflows/assign_judgeteam_roles.rb:30:in `process_admins'
        1: from app/workflows/assign_judgeteam_roles.rb:56:in `incorrect_admin_count?'
NameError (undefined local variable or method `judge_team' for #<AssignJudgeteamRoles:0x0000000009cdc4c8 @dry_run=true>)
# Also: Two JudgeTeams have two admins already!!
# JudgeTeam id: 229, type: "JudgeTeam", name: "VACOMCLEOK1", 
#   Admins: BVAKOSBORNE & VACOBRAYW
# JudgeTeam id: 230, type: "JudgeTeam", name: "BVAKOSBORNE",
#   Admins: VACOMCLEOK1 & VACOHIGHTJ
# DVCs already added a second admin to their team. This is not expected and uncertain what this means in the current code or the implications for our larger conversion steps

va-bot pushed a commit that referenced this issue Nov 12, 2019
Connects #12421 

### Description
Invocation as well as definition.
@lomky
Copy link
Contributor Author

lomky commented Nov 12, 2019

Run in production. Log of the run can be found on slack

Todo:

  • File ticket for investigation & cleanup for empty judge teams
  • Update epic with warning of existing double-admin teams

@lomky lomky mentioned this issue Nov 12, 2019
4 tasks
@lomky lomky closed this as completed Nov 13, 2019
@araposo-tistatech araposo-tistatech changed the title SCM: Migrate existing Judge Teams to use Judge & Attorney Roles CM: Migrate existing Judge Teams to use Judge & Attorney Roles Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants