Skip to content

Commit

Permalink
wip3
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpmessner committed Aug 4, 2024
1 parent edaa94f commit 4197724
Show file tree
Hide file tree
Showing 16 changed files with 778 additions and 531 deletions.
29 changes: 8 additions & 21 deletions app/models/appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ def contested_claim?

# :reek:RepeatedConditionals
# decision issue status overrules request issues/special issue list for both mst and pact
#
# POSSIBLE N+1
#
def mst?
return false unless FeatureToggle.enabled?(:mst_identification, user: RequestStore[:current_user])

Expand All @@ -284,29 +281,19 @@ def pact?
# Returns the most directly responsible party for an appeal when it is at the Board,
# mirroring Legacy Appeals' location code in VACOLS
def assigned_to_location
compute_assigned_to_location(
recently_updated_task(
tasks.active.visible_in_queue_table_view,
tasks.on_hold.visible_in_queue_table_view
),
tasks.most_recently_updated
) || decorated_with_status.fetch_status.to_s.titleize
end

def recently_updated_task(active_tasks, on_hold_tasks)
Task.any_recently_updated(
active_tasks,
on_hold_tasks
)
end

def compute_assigned_to_location(recently_updated_task, most_recently_updated_task)
return COPY::CASE_LIST_TABLE_POST_DECISION_LABEL if root_task&.status == Constants.TASK_STATUSES.completed

recently_updated_task = Task.any_recently_updated(
tasks.active.visible_in_queue_table_view,
tasks.on_hold.visible_in_queue_table_view
)

return recently_updated_task.assigned_to_label if recently_updated_task

# this condition is no longer needed since we only want active or on hold tasks
most_recently_updated_task&.assigned_to_label if most_recently_updated_task.present?
return tasks.most_recently_updated&.assigned_to_label if tasks.any?

decorated_with_status.fetch_status.to_s.titleize
end

delegate :program, to: :decorated_with_status
Expand Down
Loading

0 comments on commit 4197724

Please sign in to comment.