Skip to content

Commit

Permalink
Revert "hotfix/APPEALS-23420: search defect" (#23011)
Browse files Browse the repository at this point in the history
This reverts commit 25ed7f1.
  • Loading branch information
ronwabVa authored Sep 27, 2024
1 parent 25ed7f1 commit c231266
Show file tree
Hide file tree
Showing 29 changed files with 103 additions and 1,905 deletions.
4 changes: 2 additions & 2 deletions app/controllers/idt/api/v2/appeals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def details
result = if docket_number?(case_search)
CaseSearchResultsForDocketNumber.new(
docket_number: case_search, user: current_user
).api_call
).call
else
CaseSearchResultsForVeteranFileNumber.new(
file_number_or_ssn: case_search, user: current_user
).api_call
).call
end

render_search_results_as_json(result)
Expand Down
12 changes: 3 additions & 9 deletions app/decorators/appeal_status_api_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
# Extends the Appeal model with methods for the Appeals Status API

class AppealStatusApiDecorator < ApplicationDecorator
def initialize(appeal, scheduled_hearing = nil)
super(appeal)

@scheduled_hearing = scheduled_hearing
end

def appeal_status_id
"A#{id}"
end
Expand Down Expand Up @@ -168,19 +162,19 @@ def remanded_sc_decision_issues
end

def open_pre_docket_task?
open_tasks.any? { |task| task.is_a?(PreDocketTask) }
tasks.open.any? { |task| task.is_a?(PreDocketTask) }
end

def pending_schedule_hearing_task?
pending_schedule_hearing_tasks.any?
tasks.open.where(type: ScheduleHearingTask.name).any?
end

def hearing_pending?
scheduled_hearing.present?
end

def evidence_submission_hold_pending?
evidence_submission_hold_pending_tasks.any?
tasks.open.where(type: EvidenceSubmissionWindowTask.name).any?
end

def at_vso?
Expand Down
16 changes: 2 additions & 14 deletions app/models/appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,6 @@ def decorated_with_status
AppealStatusApiDecorator.new(self)
end

def open_tasks
tasks.open
end

def pending_schedule_hearing_tasks
tasks.open.where(type: ScheduleHearingTask.name)
end

def evidence_submission_hold_pending_tasks
tasks.open.where(type: EvidenceSubmissionWindowTask.name)
end

# :reek:RepeatedConditionals
def active_request_issues_or_decision_issues
decision_issues.empty? ? active_request_issues : fetch_all_decision_issues
Expand Down Expand Up @@ -645,7 +633,7 @@ def direct_review_docket?
end

def active?
open_tasks.of_type(:RootTask).any?
tasks.open.of_type(:RootTask).any?
end

def ready_for_distribution?
Expand Down Expand Up @@ -760,7 +748,7 @@ def substitutions
end

def status
@status ||= BVAAppealStatus.new(tasks: tasks)
@status ||= BVAAppealStatus.new(appeal: self)
end

def previously_selected_for_quality_review
Expand Down
8 changes: 3 additions & 5 deletions app/models/hearing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,12 @@ def advance_on_docket_motion
.first
end

def scheduled_for
scheduled_for_hearing_day(hearing_day, updated_by, regional_office_timezone)
end

# returns scheduled datetime object considering the timezones
# @return [nil] if hearing_day is nil
# @return [Time] in scheduled_in_timezone timezone - if scheduled_datetime and scheduled_in_timezone are present
# @return [Time] else datetime in regional office timezone
def scheduled_for_hearing_day(hearing_day, updated_by, regional_office_timezone)
# rubocop:disable Metrics/AbcSize
def scheduled_for
return nil unless hearing_day

# returns datetime in scheduled_in_timezone timezone
Expand Down Expand Up @@ -237,6 +234,7 @@ def scheduled_for_hearing_day(hearing_day, updated_by, regional_office_timezone)
)
end
end
# rubocop:enable Metrics/AbcSize

def scheduled_for_past?
scheduled_for < DateTime.yesterday.in_time_zone(regional_office_timezone)
Expand Down
6 changes: 1 addition & 5 deletions app/models/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class << self; undef_method :open; end
# Equivalent to .reject(&:hide_from_queue_table_view) but offloads that to the database.
scope :visible_in_queue_table_view, lambda {
where.not(
type: hidden_task_classes
type: Task.descendants.select(&:hide_from_queue_table_view).map(&:name)
)
}

Expand Down Expand Up @@ -138,10 +138,6 @@ class << self
# With taks that are likely to need Reader to complete
READER_PRIORITY_TASK_TYPES = [JudgeAssignTask.name, JudgeDecisionReviewTask.name].freeze

def hidden_task_classes
Task.descendants.select(&:hide_from_queue_table_view).map(&:name)
end

def reader_priority_task_types
READER_PRIORITY_TASK_TYPES
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/tasks/evidence_submission_window_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class EvidenceSubmissionWindowTask < Task

before_validation :set_assignee

def initialize(args = {})
def initialize(args)
@end_date = args&.fetch(:end_date, nil)
super(args&.except(:end_date))
end
Expand Down
75 changes: 46 additions & 29 deletions app/services/bva_appeal_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Determine the BVA workflow status of an Appeal (symbol and string) based on its Tasks.

class BVAAppealStatus
attr_reader :status, :tasks
attr_reader :status

SORT_KEYS = {
not_distributed: 1,
Expand Down Expand Up @@ -69,18 +69,8 @@ def attorney_task_names
end
end

Tasks = Struct.new(
:open,
:active,
:in_progress,
:cancelled,
:completed,
:assigned,
keyword_init: true
)

def initialize(tasks:)
@tasks = tasks
def initialize(appeal:)
@appeal = appeal
@status = compute
end

Expand All @@ -96,12 +86,15 @@ def to_i
SORT_KEYS[status]
end

def as_json(_args = nil)
def as_json(_args)
to_sym
end

private

attr_reader :appeal

delegate :tasks, to: :appeal
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
def compute
if open_pre_docket_task?
Expand All @@ -120,7 +113,7 @@ def compute
:ready_for_signature
elsif active_sign_task?
:signed
elsif completed_dispatch_task? && tasks.open.empty?
elsif completed_dispatch_task? && open_tasks.empty?
:dispatched
elsif completed_dispatch_task?
:post_dispatch
Expand All @@ -140,60 +133,84 @@ def compute
end
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength

def open_tasks
@open_tasks ||= tasks.open
end

def active_tasks
@active_tasks ||= tasks.active
end

def assigned_tasks
@assigned_tasks ||= tasks.assigned
end

def in_progress_tasks
@in_progress_tasks ||= tasks.in_progress
end

def cancelled_tasks
@cancelled_tasks ||= tasks.cancelled
end

def completed_tasks
@completed_tasks ||= tasks.completed
end

def open_pre_docket_task?
tasks.open.any? { |task| task.type == "PreDocketTask" }
open_tasks.any? { |task| task.is_a?(PreDocketTask) }
end

def open_distribution_task?
tasks.open.any? { |task| task.type == "DistributionTask" }
open_tasks.any? { |task| task.is_a?(DistributionTask) }
end

def open_timed_hold_task?
tasks.open.any? { |task| task.type == "TimedHoldTask" }
open_tasks.any? { |task| task.is_a?(TimedHoldTask) }
end

def active_judge_assign_task?
tasks.active.any? { |task| task.type == "JudgeAssignTask" }
active_tasks.any? { |task| task.is_a?(JudgeAssignTask) }
end

def assigned_attorney_task?
tasks.assigned.any? { |task| self.class.attorney_task_names.include?(task.type) }
assigned_tasks.any? { |task| self.class.attorney_task_names.include?(task.type) }
end

def active_colocated_task?
tasks.active.any? { |task| self.class.colocated_task_names.include?(task.type) }
active_tasks.any? { |task| self.class.colocated_task_names.include?(task.type) }
end

def attorney_task_in_progress?
tasks.in_progress.any? { |task| self.class.attorney_task_names.include?(task.type) }
in_progress_tasks.any? { |task| self.class.attorney_task_names.include?(task.type) }
end

def active_judge_decision_review_task?
tasks.active.any? { |task| task.type == "JudgeDecisionReviewTask" }
active_tasks.any? { |task| task.is_a?(JudgeDecisionReviewTask) }
end

def active_sign_task?
tasks.active.any? { |task| %w[BvaDispatchTask QualityReviewTask].include?(task.type) }
active_tasks.any? { |task| %w[BvaDispatchTask QualityReviewTask].include?(task.type) }
end

def completed_dispatch_task?
tasks.completed.any? { |task| task.type == "BvaDispatchTask" }
completed_tasks.any? { |task| task.is_a?(BvaDispatchTask) }
end

def docket_switched?
# TODO: this should be updated to check that there are no active tasks once the task handling is implemented
tasks.completed.any? { |task| task.type == "DocketSwitchGrantedTask" }
completed_tasks.any? { |task| task.is_a?(DocketSwitchGrantedTask) }
end

def cancelled_root_task?
tasks.cancelled.any? { |task| task.type == "RootTask" }
cancelled_tasks.any? { |task| task.is_a?(RootTask) }
end

def misc_task?
tasks.active.any? { |task| self.class.misc_task_names.include?(task.type) }
active_tasks.any? { |task| self.class.misc_task_names.include?(task.type) }
end

def active_specialty_case_team_assign_task?
tasks.active.any? { |task| task.type == "SpecialtyCaseTeamAssignTask" }
active_tasks.any? { |task| task.is_a?(SpecialtyCaseTeamAssignTask) }
end
end
Loading

0 comments on commit c231266

Please sign in to comment.