Skip to content

Commit

Permalink
Matt g/appeals 25438 (#19258)
Browse files Browse the repository at this point in the history
* APPEALS-25438

Added new function on legacy blocking tasks as well as new seed data generation path for scenario 1 edge case data

* APPEALS-25438

Rubocop Fixes

* APPEALS-25438

Added more complexity to hearing tasks
  • Loading branch information
MuhGrayVA authored Aug 24, 2023
1 parent 9e55af3 commit bc6e9ee
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/models/tasks/foia_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ class FoiaTask < Task
def available_actions(user)
super(user).reject { |action| action == Constants.TASK_ACTIONS.ASSIGN_TO_TEAM.to_h }
end

## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution
def legacy_blocking
true
end
end
4 changes: 4 additions & 0 deletions app/models/tasks/hearing_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def default_instructions
[COPY::HEARING_TASK_DEFAULT_INSTRUCTIONS]
end

## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution
def legacy_blocking
true
end

def cancel_and_recreate
hearing_task = HearingTask.create!(
Expand Down
5 changes: 5 additions & 0 deletions app/models/tasks/privacy_act_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
class PrivacyActTask < Task
include CavcAdminActionConcern

## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution
def legacy_blocking
true
end

def available_actions(user)
return [] unless user

Expand Down
5 changes: 5 additions & 0 deletions app/models/tasks/transcription_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def available_actions(user)
end
end

## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution
def legacy_blocking
true
end

def update_from_params(params, current_user)
multi_transaction do
verify_user_can_update!(current_user)
Expand Down
5 changes: 5 additions & 0 deletions app/models/tasks/translation_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
class TranslationTask < Task
include CavcAdminActionConcern

## Tag to determine if this task is considered a blocking task for Legacy Appeal Distribution
def legacy_blocking
true
end

def self.create_from_root_task(root_task)
create!(assigned_to: Translation.singleton, parent_id: root_task.id, appeal: root_task.appeal)
end
Expand Down
104 changes: 101 additions & 3 deletions lib/tasks/seed_legacy_appeal_tasks.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# to create legacy appeals with AMA Tasks added, run "bundle exec rake db:generate_legacy_appeals_with_tasks"
# then select an option between 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', and 'Brieff_Curloc_81_Task'
# then select an option between 'HearingTask', 'JudgeTask', 'AttorneyTask', 'ReviewTask', 'Scenario1edge' and 'Brieff_Curloc_81_Task'

namespace :db do
desc "Generates a smattering of legacy appeals with VACOLS cases that have special issues assocaited with them"
Expand All @@ -10,7 +10,7 @@ namespace :db do
class << self
def stamp_out_legacy_appeals(num_appeals_to_create, file_number, user, docket_number, task_type)
# Changes location of vacols based on if you want a hearing task or only a legacy task in location 81
bfcurloc = if task_type == "HEARINGTASK"
bfcurloc = if task_type == "HEARINGTASK" || task_type == "SCENARIO1EDGE"
57
elsif task_type == "BRIEFF_CURLOC_81_TASK"
81
Expand Down Expand Up @@ -218,6 +218,102 @@ namespace :db do
$stdout.puts("You have created a Review task")
end

########################################################
# Creates Edge case data for the LegacyAppeals that have just been generated
# Scenario 1
def create_edge_case_task_for_legacy_appeals(appeal)
root_task = RootTask.find_or_create_by!(appeal: appeal)
rand_val = rand(100)

case rand_val
when 0..33
hearing_task = HearingTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
ScheduleHearingTask.create!(
appeal: appeal,
parent: hearing_task,
assigned_to: Bva.singleton
)
when 34..66
hearing_task = HearingTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
ScheduleHearingTask.create!(
appeal: appeal,
parent: hearing_task,
assigned_to: Bva.singleton
).update(status: 'completed')
AssignHearingDispositionTask.create!(
appeal: appeal,
parent: hearing_task,
assigned_to: Bva.singleton
)
when 67..100
hearing_task = HearingTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
ScheduleHearingTask.create!(
appeal: appeal,
parent: hearing_task,
assigned_to: Bva.singleton
).update(status: 'completed')
AssignHearingDispositionTask.create!(
appeal: appeal,
parent: hearing_task,
assigned_to: Bva.singleton
).update(status: 'completed')
TranscriptionTask.create!(
appeal: appeal,
parent: hearing_task,
assigned_to: Bva.singleton
)
end

rand_val = rand(100)

case rand_val
when 0..20
FoiaTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
when 21..40
PrivacyActTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
when 41..60
PowerOfAttorneyRelatedMailTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
when 61..80
TranslationTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
when 81..100
CongressionalInterestMailTask.create!(
appeal: appeal,
parent: root_task,
assigned_to: Bva.singleton
)
end

$stdout.puts("You have created a Hearing Task")
end

def initialize_root_task_for_legacy_appeals(appeal)
RootTask.find_or_create_by!(appeal: appeal)
$stdout.puts("You have set the Location to 81")
Expand All @@ -234,6 +330,8 @@ namespace :db do
create_review_task_for_legacy_appeals(appeal, user)
elsif task_type == "BRIEFF_CURLOC_81_TASK"
initialize_root_task_for_legacy_appeals(appeal)
elsif task_type == "SCENARIO1EDGE"
create_edge_case_task_for_legacy_appeals(appeal)
end
# rubocop:enable
end
Expand Down Expand Up @@ -270,7 +368,7 @@ namespace :db do

$stdout.puts("Which type of tasks do you want to add to these Legacy Appeals?")
$stdout.puts("Hint: Options include 'HearingTask', 'JudgeTask', 'AttorneyTask',
'ReviewTask', and 'Brieff_Curloc_81_Task'")
'ReviewTask', 'Scenario1edge' and 'Brieff_Curloc_81_Task'")
task_type = $stdin.gets.chomp.upcase
if task_type == "JUDGETASK" || task_type == "REVIEWTASK"
$stdout.puts("Enter the CSS ID of a judge user that you want to assign these appeals to")
Expand Down

0 comments on commit bc6e9ee

Please sign in to comment.