-
Notifications
You must be signed in to change notification settings - Fork 19
Task Reassignment Taxonomies
laurenyj edited this page Oct 16, 2023
·
16 revisions
Here are a few easy rails console commands to check various attributes that may help with troubleshooting
Set old_user and new_user variables with CSS IDs
old_user = User.find_by_css_id("<inactive user id>")
new_user = User.find_by_css_id("<active user id>")
Check that the old_user is indeed inactive and the new_user is active
old_user.active?
new_user.active?
check that the users are either attorneys or judges for cases where the tasks need to be sent back to judge assign
old_user.attorney?
new_user.judge?
check the count of tasks associated with the old_user that are inactive
old_user.tasks.where.not(status: ["completed", "cancelled"]).count
Checks for tasks associated with legacy appeals
old_user.tasks.where(appeal_type: "LegacyAppeal").count
This is primarily done when a user changes their CSS ID. Please ensure that the ask is for all inactive tasks to be reassigned and not just those that are active.
- Set old_user and new_user variables with CSS IDs
old_user = User.find_by_css_id("<inactive user id>")
new_user = User.find_by_css_id("<active user id>")
- take note of current user task counts
old_user.tasks.count
new_user.tasks.count
- Check the count of all tasks that are inactive
old_user.tasks.where.not(status: ["completed", "cancelled", "on_hold"]).count
- Set counter variable to track number of jobs reassigned
counter = 0
- find the tasks that need to be reassigned based on the tasks assigned to the old user
assigned_tasks = old_user.tasks
- update the tasks and increment the counter
assigned_tasks.each{|task| task.update!(assigned_to_id: new_user.id, assigned_by_id: task.assigned_by_id) && counter += 1}
- If you encounter the error "ActiveRecord::RecordInvalid (Validation failed: Assigned to has to be an attorney)" reload the task or tasks and try running the update again
assigned_tasks.reload
- check the counts of the counter and both user task counts to ensure they have incremented and decremented as expected
counter
old_user.tasks.count
new_user.tasks.count
- Set the user variables
old_user = User.find_by_css_id("<inactive user css id>")
new_user = User.find_by_css_id("<active user css id>")
- instantiate array with appeal ids given. it's ok if it's just one
appeal_ids = ["<ID>","<ID>","<ID>"]
- take note of current user task counts
old_user.tasks.count
new_user.tasks.count
- set counter variable to track number of jobs reassigned
counter = 0
- find the tasks requested for reassignment by cross referencing appeal_ids and the old_user.id
assigned_tasks = Task.where(appeal_id: appeal_ids, assigned_to: old_user)
- ensure that the count of the assigned_tasks array matches the expected amount of tasks to be reassigned
assigned_tasks.count
- update the tasks and increment the counter
assigned_tasks.each{|task| task.update!(assigned_to_id: new_user.id, assigned_by_id: task.assigned_by_id) && counter += 1}
- if you encounter the error "ActiveRecord::RecordInvalid (Validation failed: Assigned to has to be an attorney)" reload the task or tasks and try running the update again if not proceed to check counts
assigned_tasks.reload
- check the counts of the counter and both user task counts to ensure they have incremented and decremented as expected
counter
old_user.tasks.count
new_user.tasks.count
- Assign old user to a variable
old_user = User.find_by_css_id("<inactive user id>")
- Assign new user to a variable
new_user = User.find_by_css_id("<active user id>")
- Take note of current user task counts
old_user.tasks.count
new_user.tasks.count
- Check the count of all tasks that are inactive
old_user.tasks.where.not(status: ["completed", "cancelled"]).count
- Set counter variable to track number of jobs reassigned
counter = 0
- Find the tasks that need to be reassigned based on the tasks assigned to the old user
assigned_tasks = old_user.tasks.where.not(status: ["completed", "cancelled"]))
- Update the tasks and increment the counter
assigned_tasks.each{|task| task.update!(assigned_to_id: new_user.id, assigned_by_id: task.assigned_by_id) && counter += 1}
- If you encounter the error "ActiveRecord::RecordInvalid (Validation failed: Assigned to has to be an attorney)" reload the task or tasks and try running the update again
assigned_tasks.reload
- Check the counts of the counter and both user task counts to ensure they have incremented and decremented as expected
counter
old_user.tasks.count
new_user.tasks.count
- Set the new_user variable with CSS ID
new_user = User.find_by_css_id("<active user css id>")
- Set the old_user variable with CSS ID
old_user = User.find_by_css_id("<active user css id>")
- List all tasks that need to be reassigned
task_ids = ["<ID>","<ID>","<ID>"]
- Set a variable with all assigned tasks
assigned_tasks = Task.where(id: task_ids)
- Check task count for the new_user and old_user
new_user.tasks.count
old_user.tasks.count
- If old user not included, utilize the assigned tasks to find the user and their task count
old_users = assigned_tasks.map(&:assigned_to).uniq
old_users.map { |user| user.tasks.count }
- Count the number of tasks and ensure it matches the length of the array
assigned_tasks.count
- Set a counter to be incremented based on how many tasks are reassigned
counter = 0
- Reassign each task into the new_user provided and update the counter
assigned_tasks.each{|task| task.update!(assigned_to_id: new_user.id, assigned_by_id: task.assigned_by_id) && counter += 1}
- If you encounter the error "ActiveRecord::RecordInvalid (Validation failed: Assigned to has to be an attorney)" reload the task or tasks and try running the update again
assigned_tasks.reload
- Verify the counter aligns with the length of the task array
counter
- Verify the count of the users tasks increased
new_user.tasks.count
old_user.tasks.count
- If old user not included verify count using this approach
old_users.map { |user| user.tasks.count }
- Set the user variables
old_user = User.find_by_css_id("inactive user css id")
new_user = User.find_by_css_id("<active user css id>")
- Instantiate array with appeal ids given by appeal uuid(s)
appeal_uuids = ["<UUID>","<UUID>","<UUID>"]
appeal_ids = Appeal.where(uuid: appeal_uuids).pluck(:id)
- Set counter variable to track number of jobs reassigned and check both user task counts for self-auditing
counter = 0
old_user.tasks.count
new_user.tasks.count
- Find the tasks requested for reassignment by cross referencing appeal_ids and the old_user.id
assigned_tasks = Task.where(appeal_id: appeal_ids, assigned_to: old_user)
- Ensure that the count of the assigned_tasks array matches the expected amount of tasks to be reassigned
assigned_tasks.count == old_user.tasks.where(appeal_id: appeal_ids).count
- Update the tasks to new user and increment the counter
assigned_tasks.each{|task| task.update!(assigned_to_id: new_user.id, assigned_by_id: task.assigned_by_id) && counter += 1}
- If you encounter the error "ActiveRecord::RecordInvalid (Validation failed: Assigned to has to be an attorney)" reload the task or tasks and try running the update again if not proceed to check counts
assigned_tasks.reload
- Check the counts of the counter and both user task counts to ensure they have incremented and decremented as expected. Check both user tasks to ensure reassignment
counter
old_user.tasks.count
new_user.tasks.count
assigned_task_ids = assigned_tasks.pluck(:appeal_id)
new_user_task_ids = new_user.tasks.where(appeal_id: assigned_task_ids)
assigned_task_ids.count == new_user_task_ids.count
- Home
- Acronyms and Glossary
- Caseflow products
- Caseflow Intake
- Caseflow Queue
- Appeals Consumer
- Caseflow Reader
- Caseflow eFolder
- Caseflow Hearings
- Caseflow Certification
- Caseflow APIs
- Appeal Status API
- Caseflow Dispatch
-
CSUM Roles
- System Admin
- VHA Team Management
- Active Record Queries Resource
- External Integrations
- Caseflow Demo
- Caseflow ProdTest
- Background
- Stuck Jobs
- VA Notify
-
Caseflow-Team
- Tier 4
- Bat Team
- Technical Documentation
- Backend Code Patterns
- Backend Working Group
- FACOLS, VACOLS DB Schema
- Asyncable Models
- External Data: where and why
- Data Fetching Scripts
- Caseflow Data Model and Dictionary
- User Access Permissions
- Controller Schemas
- Constants
- Frontend Best Practices
- Accessibility
- How-To
- Debugging Tips
- Adding a Feature Flag with FeatureToggle
- Editing AMA issues
- Editing a decision review
- Fixing task trees
- Investigating and diagnosing issues
- Data and Metric Request Workflow
- Exporting and Importing Appeals
- Explain page for Appeals
- Record associations and Foreign Keys
- Upgrading Ruby
- Stuck Appeals
- Testing Action Mailer Messages Locally
- Re-running Seed Files
- Rake Generator for Legacy Appeals
- Manually running Scheduled Jobs
- System Admin UI
- Caseflow Makefile
- Upgrading Postgresql from v11.7 to v14.8 Locally
- VACOLS VM Trigger Fix M1
- Using SlackService to Send a Job Alert
- Technical Talks