Skip to content

Commit

Permalink
Merge branch 'master' into dev-support/APPEALS-51189
Browse files Browse the repository at this point in the history
  • Loading branch information
craigrva authored Jul 12, 2024
2 parents 8d45767 + 67e62f3 commit 84768fe
Show file tree
Hide file tree
Showing 236 changed files with 14,991 additions and 3,362 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ gem "request_store"
gem "roo", "~> 2.7"
gem "rswag-api"
gem "rswag-ui"
gem "ruby_claim_evidence_api", git: "https://github.com/department-of-veterans-affairs/ruby_claim_evidence_api.git", ref: "fed623802afe7303f4b8b5fe27cff0e903699873"
# Use SCSS for stylesheets
gem "sass-rails", "~> 5.0"
# Error reporting to Sentry
Expand Down
20 changes: 19 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ GIT
nokogiri (>= 1.11.0.rc4)
savon (~> 2.12)

GIT
remote: https://github.com/department-of-veterans-affairs/ruby_claim_evidence_api.git
revision: fed623802afe7303f4b8b5fe27cff0e903699873
ref: fed623802afe7303f4b8b5fe27cff0e903699873
specs:
ruby_claim_evidence_api (0.0.1)
activesupport
base64
faraday
faraday-multipart
httpi
railties
webmock (~> 3.6.2)

GIT
remote: https://github.com/department-of-veterans-affairs/sniffybara.git
revision: 351560b5789ca638ba7c9b093c2bb1a9a6fda4b3
Expand Down Expand Up @@ -1440,6 +1454,7 @@ GEM
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
backport (1.2.0)
base64 (0.2.0)
benchmark-ips (2.7.2)
bootsnap (1.7.5)
msgpack (~> 1.0)
Expand Down Expand Up @@ -1580,6 +1595,8 @@ GEM
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.4.1)
faraday (>= 0.8)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
fast_jsonapi (1.5)
Expand Down Expand Up @@ -2115,6 +2132,7 @@ DEPENDENCIES
ruby-debug-ide
ruby-oci8 (~> 2.2)
ruby-prof (~> 1.4)
ruby_claim_evidence_api!
sass-rails (~> 5.0)
scss_lint
sentry-raven
Expand All @@ -2139,4 +2157,4 @@ DEPENDENCIES
ziptz

BUNDLED WITH
2.4.17
2.4.22
32 changes: 28 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ def case_distribution_url
}
end

def test_seeds_url
{
title: "Test Seeds",
link: "/test/seeds",
sort_order: 7
}
end

def hearing_application_url
{
title: "Hearings",
Expand Down Expand Up @@ -210,14 +218,30 @@ def manage_users_menu_item

def admin_menu_items
admin_urls = []
admin_urls.concat(manage_teams_menu_items) if current_user&.administered_teams&.any?
admin_urls.push(manage_users_menu_item) if current_user&.can_view_user_management?
admin_urls.push(case_distribution_url) if current_user&.organizations&.any?(&:users_can_view_levers?)
add_team_management_items(admin_urls)
add_user_management_items(admin_urls)
add_case_distribution_item(admin_urls)

admin_urls.flatten
end

def add_team_management_items(admin_urls)
if current_user&.can_view_team_management? || current_user&.can_view_judge_team_management?
admin_urls.unshift(manage_all_teams_menu_item)
end
admin_urls.flatten
end

def add_user_management_items(admin_urls)
admin_urls.concat(manage_teams_menu_items) if current_user&.administered_teams&.any?
admin_urls.push(manage_users_menu_item) if current_user&.can_view_user_management?
end

def add_case_distribution_item(admin_urls)
admin_urls.push(case_distribution_url) if current_user&.organizations&.any?(&:users_can_view_levers?)
end

def add_test_seeds_item(admin_urls)
admin_urls.push(test_seeds_url) if current_user&.organizations&.any?(&:users_can_view_levers?)
end

def dropdown_urls
Expand Down
27 changes: 27 additions & 0 deletions app/controllers/case_distribution_levers_tests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ def run_demo_aod_hearing_seeds
head :ok
end

def run_demo_ama_docket_goals
Rake::Task["db:seed:demo_ama_docket_goals_lever_test_data"].reenable
Rake::Task["db:seed:demo_ama_docket_goals_lever_test_data"].invoke

head :ok
end

def run_demo_docket_priority
Rake::Task["db:seed:demo_docket_priority_lever_test_data"].reenable
Rake::Task["db:seed:demo_docket_priority_lever_test_data"].invoke

head :ok
end

def appeals_ready_to_distribute
csv_data = AppealsReadyForDistribution.process

Expand All @@ -39,6 +53,19 @@ def appeals_ready_to_distribute
send_data csv_data, filename: filename
end

def appeals_non_priority_ready_to_distribute
csv_data = AppealsNonPriorityReadyForDistribution.process

# Get the current date and time for dynamic filename
current_datetime = Time.zone.now.strftime("%Y%m%d-%H%M")

# Set dynamic filename with current date and time
filename = "AMA_Non_priority_distributable_#{current_datetime}.csv"

# Send CSV as a response with dynamic filename
send_data csv_data, filename: filename
end

def appeals_distributed
# change this to the correct class
csv_data = AppealsDistributed.process
Expand Down
100 changes: 87 additions & 13 deletions app/controllers/claim_review_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def edit
end

def update
if request_issues_update.perform!
if issues_modification_request_updater.non_admin_actions?
process_and_render_issue_non_admin_issue_modification_requests
elsif issues_modification_request_updater.admin_actions?
process_and_render_issue_admin_issue_modification_requests
elsif request_issues_update.perform!
render_success
else
render json: { error_code: request_issues_update.error_code }, status: :unprocessable_entity
Expand Down Expand Up @@ -56,6 +60,14 @@ def source_type
fail "Must override source_type"
end

def issues_modification_request_updater
@issues_modification_request_updater ||= IssueModificationRequests::Updater.new(
user: current_user,
review: claim_review,
issue_modifications_data: params[:issue_modification_requests]
)
end

def request_issues_update
@request_issues_update ||= RequestIssuesUpdate.new(
user: current_user,
Expand Down Expand Up @@ -133,15 +145,23 @@ def removed_issues
end

def review_edited_message
"You have successfully " + [added_issues, removed_issues, withdrawn_issues].compact.to_sentence + "."
"You have successfully #{[added_issues, removed_issues, withdrawn_issues].compact.to_sentence}."
end

def vha_edited_decision_date_message
COPY::VHA_ADD_DECISION_DATE_TO_ISSUE_SUCCESS_MESSAGE
end

def vha_established_message
"You have successfully established #{claimant_name}'s #{claim_review.class.review_title}"
def vha_pending_reviews_message
"#{claimant_name}'s #{claim_review.class.review_title} was saved."
end

def vha_edited_title
"You have successfully edited #{claimant_name}'s #{claim_review.class.review_title}"
end

def vha_edited_message
"The claim has been modified."
end

def claimant_name
Expand All @@ -158,27 +178,53 @@ def vha_flash_message
request_issues_update.removed_or_withdrawn_issues)
.select { |issue| issue.decision_date.blank? && !issue.withdrawn? }

if issues_without_decision_date.empty?
vha_established_message
if claim_review.pending_issue_modification_requests.any?
vha_pending_reviews_message_hash
elsif issues_without_decision_date.empty?
{ title: vha_edited_title, message: vha_edited_message }
elsif request_issues_update.edited_issues.any?
vha_edited_decision_date_message
{ title: "Edit Completed", message: vha_edited_decision_date_message }
else
review_edited_message
decisions_message_hash_builder(vha_edited_message, review_edited_message)
end
end

def set_flash_success_message
flash[:edited] = if request_issues_update.after_issues.empty?
decisions_removed_message
flash[:custom] = if request_issues_update.after_issues.empty?
decisions_removed_hash
elsif (request_issues_update.after_issues - request_issues_update.withdrawn_issues).empty?
review_withdrawn_message
elsif claim_review.benefit_type == "vha"
decisions_withdrawn_hash
elsif claim_review.vha_claim?
vha_flash_message
else
review_edited_message
{ title: "Edit Completed", message: review_edited_message }
end
end

def decisions_message_hash_builder(vha_message, default_message)
if claim_review.vha_claim?
{ title: vha_edited_title, message: vha_message }
else
{ title: "Edit Completed", message: default_message }
end
end

def decisions_removed_hash
decisions_message_hash_builder("The claim has been removed.", decisions_removed_message)
end

def decisions_withdrawn_hash
decisions_message_hash_builder("The claim has been withdrawn.", review_withdrawn_message)
end

def vha_pending_reviews_message_hash
if current_user.vha_business_line_admin_user?
{ title: vha_edited_title, message: vha_edited_message }
else
{ title: "You have successfully submitted a request.", message: vha_pending_reviews_message }
end
end

def decisions_removed_message
"You have successfully removed #{claim_review.class.review_title} for #{claimant_name}
(ID: #{claim_review.veteran.ssn})."
Expand All @@ -203,4 +249,32 @@ def perform_ep_update!(epe)
ep_update.perform!
ep_update
end

def process_and_render_issue_non_admin_issue_modification_requests
issues_modification_request_updater.non_admin_process!
render_success
rescue StandardError => error
render_error(error)
end

def process_and_render_issue_admin_issue_modification_requests
# If there are no approvals, then we can just deny the requests. We do not need to process request_issues_updates
if issues_modification_request_updater.admin_approvals?
if request_issues_update.can_be_performed?
issues_modification_request_updater.admin_process!
if request_issues_update.perform!
return render_success
end
end

# Fallback return error since it fell through
render json: { error_code: request_issues_update.error_code }, status: :unprocessable_entity
else
# Only denied requests to just run the process and return success unless it errors
issues_modification_request_updater.admin_process!
render_success
end
rescue StandardError => error
render_error(error)
end
end
14 changes: 13 additions & 1 deletion app/controllers/decision_reviews_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class DecisionReviewsController < ApplicationController
:in_progress_tasks,
:in_progress_tasks_type_counts,
:in_progress_tasks_issue_type_counts,
:pending_tasks,
:pending_tasks_type_counts,
:pending_tasks_issue_type_counts,
:completed_tasks,
:completed_tasks_type_counts,
:completed_tasks_issue_type_counts,
Expand All @@ -29,7 +32,8 @@ class DecisionReviewsController < ApplicationController
"issueCountColumn" => "issue_count",
"issueTypesColumn" => "issue_types_lower",
"daysWaitingColumn" => "tasks.assigned_at",
"completedDateColumn" => "tasks.closed_at"
"completedDateColumn" => "tasks.closed_at",
"pendingIssueModificationRequests" => "pending_issue_count"
}.freeze

def index
Expand Down Expand Up @@ -68,6 +72,10 @@ def history
end

def update
if task.appeal.pending_issue_modification_requests.any?
return render json: { error_uuid: error_uuid, error_code: "pendingModificationRequests" }, status: :bad_request
end

if task.complete_with_payload!(decision_issue_params, decision_date, current_user)
business_line.tasks.reload
render json: { task_filter_details: task_filter_details }, status: :ok
Expand Down Expand Up @@ -124,6 +132,9 @@ def task_filter_details
when :incomplete
task_filter_hash[:incomplete] = incomplete_tasks_type_counts
task_filter_hash[:incomplete_issue_types] = incomplete_tasks_issue_type_counts
when :pending
task_filter_hash[:pending] = pending_tasks_type_counts
task_filter_hash[:pending_issue_types] = pending_tasks_issue_type_counts
when :in_progress
task_filter_hash[:in_progress] = in_progress_tasks_type_counts
task_filter_hash[:in_progress_issue_types] = in_progress_tasks_issue_type_counts
Expand Down Expand Up @@ -180,6 +191,7 @@ def queue_tasks

tasks = case tab_name
when "incomplete" then incomplete_tasks(pagination_query_params(sort_by_column))
when "pending" then pending_tasks(pagination_query_params(sort_by_column))
when "in_progress" then in_progress_tasks(pagination_query_params(sort_by_column))
when "completed" then completed_tasks(pagination_query_params(sort_by_column))
when nil
Expand Down
1 change: 1 addition & 0 deletions app/controllers/intakes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def index_props
userDisplayName: current_user.display_name,
userCanIntakeAppeals: current_user.can_intake_appeals?,
userCanEditIntakeIssues: current_user.can_edit_intake_issues?,
userIsVhaAdmin: current_user.vha_business_line_admin_user?,
serverIntake: intake_ui_hash,
dropdownUrls: dropdown_urls,
applicationUrls: application_urls,
Expand Down
Loading

0 comments on commit 84768fe

Please sign in to comment.