Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrisbdetlef/appeals 49398 #21979

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5ed7ebd
APPEALS-36339 (#21436)
Blake-Manus Apr 23, 2024
db3c6ef
Merge branch 'master' into feature/APPEALS-36234
amybids Apr 24, 2024
058a98f
Changed dockerfile to install node through NVM
sbashamoni Apr 25, 2024
c9fe300
Update env.sh with node 14.20 path
sbashamoni Apr 25, 2024
6faf06e
Removed unused node env
sbashamoni Apr 26, 2024
55252d9
Update Dockerfile Removed unused node env variable
sbashamoni Apr 29, 2024
c3e6f80
Removed unused node env
sbashamoni Apr 29, 2024
2087fda
Merge branch 'sbashamoni/APPEALS-44871-node14-demo-fixes' into featur…
amybids Apr 30, 2024
d281c11
mbeard/APPEALS-44379 (#21451)
mbeardy May 1, 2024
7b3aad6
APPEALS-44417 Seeds for Docket Lever Demo (#21534)
cdetlefva May 3, 2024
5e5f8a5
APPEALS-36345-updated (#21537)
Blake-Manus May 3, 2024
4988bd6
mbeard/APPEALS-44379 (#21530)
mbeardy May 5, 2024
6988058
APPEALS-44346 Demo Docket Goal Lever Test Seed Data (#21524)
cdetlefva May 5, 2024
4f6d286
Chrisbdetlef/appeals 40705 (#21535)
cdetlefva May 6, 2024
40d6da9
Sharsha/appeals 45531 (#21566)
SHarshain May 7, 2024
108b6a3
Updated lever history to handle null unit values from docket levers (…
Blake-Manus May 8, 2024
df08443
Sharsha/appeals 45531_1 (#21573)
SHarshain May 9, 2024
df8972c
Sharsha/appeals 45531 1 (#21609)
cdetlefva May 9, 2024
c97ef6c
APPEALS-45502. Organize route and fix the controller (#21595)
SHarshain May 9, 2024
1f1515a
Ricky/APPEALS-36345.fixes (#21612)
Blake-Manus May 13, 2024
a6c602e
ricky/APPEALS-44053 (#21587)
mbeardy May 13, 2024
5ce7292
Ricky/appeals 43523 (#21649)
amybids May 15, 2024
2d4709b
APPEALS-45898. Updated the lever_group_order values (#21639)
SHarshain May 15, 2024
19b5e37
mbeard/APPEALS-40646 (#21645)
mbeardy May 17, 2024
076cd78
Chrisbdetlef/appeals 43117.cleanup (#21671)
cdetlefva May 17, 2024
aa5971e
merged in master, fixed merge conflicts
amybids May 21, 2024
4b369dc
Minor fixes (#21694)
cdetlefva May 21, 2024
d74c125
Fix Legacy Case issues (#21747)
cdetlefva May 24, 2024
90dcab2
merged master back into the feature branch
amybids Jun 3, 2024
3392968
APPEALS-46037. Fix padding in the lever history table (#21725)
SHarshain Jun 3, 2024
fccf6c2
Fix Lauren Roth issue (#21813)
cdetlefva Jun 4, 2024
bcfdafc
ricky/APPEALS-44044 (#21814)
Blake-Manus Jun 6, 2024
6d7243a
updates ready_priority_nonpriority_appeals to public_send, updates te…
mbeardy Jun 7, 2024
49b8210
APPEALS-36333 first iteration of docket time goal and prior to goal (…
kristeja Jun 10, 2024
338f4ef
updated the seeds to align with the work completed
amybids Jun 11, 2024
900190b
Updated Toggle Switch behavior when clicked while idle (#21874)
Blake-Manus Jun 12, 2024
d59f7a0
Csv research (#21892)
SHarshain Jun 12, 2024
c612b13
APPEALS-46057. CleanUP (#21914)
SHarshain Jun 13, 2024
c084140
updates line of test to correctly build lever item (#21918)
mbeardy Jun 13, 2024
20e4de7
APPEALS-45191. Updated the query to return the date based on the calc…
SHarshain Jun 14, 2024
8af4a1e
Chrisharsha/appeals 43962 (#21929)
SHarshain Jun 14, 2024
4fa7503
APPEALS-43962. Lint fixes (#21932)
SHarshain Jun 18, 2024
172e7a0
Ricky/APPEALS-47293 (#21925)
Blake-Manus Jun 18, 2024
72fcee8
APPEALS-48292 updated the column to be a string (#21954)
amybids Jun 19, 2024
8bdbacf
APPEALS-48598 fix logic when Start Distribution Prior to Docket Time …
kristeja Jun 19, 2024
ce6933f
APPEALS-48898. Created Distributable AMA Non-priority Appeals Query (…
SHarshain Jun 19, 2024
8543d9b
Merge branch 'master' of https://github.com/department-of-veterans-af…
craigrva Jun 20, 2024
6914c7b
APPEALS-49100. getting value from the start_distribution_prior_to_goa…
SHarshain Jun 20, 2024
b369f16
Ensure that legacy appeals are being created
Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 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,31 @@ 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)
add_test_seeds_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
13 changes: 13 additions & 0 deletions app/controllers/case_distribution_levers_tests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,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
7 changes: 4 additions & 3 deletions app/controllers/concerns/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
module Errors
extend ActiveSupport::Concern
def invalid_role_error
render json: {
{
"errors": [
"title": "Role is Invalid",
"detail": "User is not allowed to perform this action"
]
}, status: :bad_request
],
"status": "bad_request"
}
end
end
8 changes: 7 additions & 1 deletion app/controllers/legacy_tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ def validate_user_id
end

def validate_user_role
return invalid_role_error unless ROLES.include?(user_role)
return true if ROLES.include?(user_role)

Rails.logger.info("User with roles #{current_user.roles.join(', ')} "\
"couldn't access #{request.original_url}: Error: #{invalid_role_error}")

session["return_to"] = request.original_url
redirect_to "/unauthorized"
end

def user
Expand Down
49 changes: 49 additions & 0 deletions app/controllers/test_docket_seeds_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# frozen_string_literal: true

class TestDocketSeedsController < ApplicationController
before_action :check_environment # , :verify_access
# before_action :current_user, only: [:reset_all_appeals]

def seed_dockets
JSON.parse(request.body.read).each do |row_entry|
task_name = Constants.TEST_SEEDS.to_h[row_entry["seed_type"].to_sym]
ENV["SEED_COUNT"] = row_entry["seed_count"].to_s
ENV["DAYS_AGO"] = row_entry["days_ago"].to_s
ENV["JUDGE_CSS_ID"] = row_entry["judge_css_id"].to_s

Rake::Task[task_name].reenable
Rake::Task[task_name].invoke

ENV.delete("SEED_COUNT")
ENV.delete("DAYS_AGO")
ENV.delete("JUDGE_CSS_ID")
end

head :ok
end

def reset_all_appeals
RequestStore[:current_user] = current_user
DistributionTask.where(status: "assigned").map { |t| t.update!(status: "on_hold") }
VACOLS::Case.where(bfcurloc: %w[81 83]).map { |c| c.update!(bfcurloc: "testing") }

head :ok
end

private

# def verify_access ##future work
# return true if current_user&.organizations && current_user.organizations.any?(&:users_can_view_levers?)

# session["return_to"] = request.original_url
# redirect_to "/unauthorized"
# end

def check_environment
return true if Rails.env.development?
return true if Rails.deploy_env?(:demo)
return true if Rails.deploy_env?(:uat)

redirect_to "/unauthorized"
end
end
41 changes: 41 additions & 0 deletions app/controllers/test_seeds_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

require "csv"

class Test::TestSeedsController < ApplicationController
before_action :check_environment
before_action :verify_access, only: [:seeds]
before_action :authorize_admin, only: [:seeds]

def seeds
# seeds
render "/test/seeds"
end

private

def check_environment
return true if Rails.env.development?
return true if Rails.deploy_env?(:demo)

redirect_to "/unauthorized"
end

def authorize_admin
error = ["UNAUTHORIZED"]

resp = {
status_code: 500,
message: error,
user_is_an_acd_admin: false
}
render json: resp unless CDAControlGroup.singleton.user_is_admin?(current_user)
end

def verify_access
return true if current_user&.organizations && current_user.organizations.any?(&:users_can_view_levers?)

session["return_to"] = request.original_url
redirect_to "/unauthorized"
end
end
8 changes: 1 addition & 7 deletions app/jobs/push_priority_appeals_to_judges_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def slack_report # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
docket_coordinator.dockets.each_pair do |sym, docket|
report << "*Number of #{sym} appeals _not_ distributed*: #{docket.count(priority: true, ready: true)}"
end
unless disable_legacy?
report << "*Number of Legacy Hearing Non Genpop appeals _not_ distributed*: #{legacy_not_genpop_count}"
end
report << "*Number of Legacy Hearing Non Genpop appeals _not_ distributed*: #{legacy_not_genpop_count}"

report << ""
report << "*Debugging information*"
Expand Down Expand Up @@ -181,10 +179,6 @@ def use_by_docket_date?
FeatureToggle.enabled?(:acd_distribute_by_docket_date, user: RequestStore.store[:current_user])
end

def disable_legacy?
FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
end

def legacy_not_genpop_count
docket_coordinator.dockets[:legacy].not_genpop_priority_count
end
Expand Down
11 changes: 10 additions & 1 deletion app/models/case_distribution_lever.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class CaseDistributionLever < ApplicationRecord
#{Constants.DISTRIBUTION.ama_hearing_case_affinity_days}
#{Constants.DISTRIBUTION.cavc_affinity_days}
#{Constants.DISTRIBUTION.ama_evidence_submission_docket_time_goals}
#{Constants.DISTRIBUTION.ama_hearings_docket_time_goals}
#{Constants.DISTRIBUTION.ama_hearing_docket_time_goals}
#{Constants.DISTRIBUTION.ama_hearing_start_distribution_prior_to_goals}
#{Constants.DISTRIBUTION.ama_evidence_submission_start_distribution_prior_to_goals}
).freeze

FLOAT_LEVERS = %W(
Expand All @@ -30,6 +32,11 @@ class CaseDistributionLever < ApplicationRecord
#{Constants.DISTRIBUTION.nod_adjustment}
).freeze

BOOLEAN_LEVERS = %W(
#{Constants.DISTRIBUTION.disable_legacy_priority}
#{Constants.DISTRIBUTION.disable_legacy_non_priority}
).freeze

def history_value
if combination_lever?
combination_value
Expand Down Expand Up @@ -184,6 +191,8 @@ def method_missing_value(name)
Integer(lever)
elsif FLOAT_LEVERS.include?(name)
Float(lever)
elsif BOOLEAN_LEVERS.include?(name)
ActiveModel::Type::Boolean.new.cast(lever)
else
lever
end
Expand Down
22 changes: 8 additions & 14 deletions app/models/concerns/by_docket_date_distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ def requested_distribution
priority_rem = priority_target.clamp(0, @rem)
distribute_priority_appeals_from_all_dockets_by_age_to_limit(priority_rem, style: "request")

unless FeatureToggle.enabled?(:acd_disable_nonpriority_distributions, user: RequestStore.store[:current_user])
# Distribute the oldest nonpriority appeals from any docket if we haven't distributed {batch_size} appeals
# @nonpriority_iterations guards against an infinite loop if not enough cases are ready to distribute
until @rem <= 0 || @nonpriority_iterations >= MAX_NONPRIORITY_ITERATIONS
distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(@rem)
end
# Distribute the oldest nonpriority appeals from any docket if we haven't distributed {batch_size} appeals
# @nonpriority_iterations guards against an infinite loop if not enough cases are ready to distribute
until @rem <= 0 || @nonpriority_iterations >= MAX_NONPRIORITY_ITERATIONS
distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(@rem)
end
@appeals
end
Expand All @@ -59,7 +57,7 @@ def distribute_nonpriority_appeals_from_all_dockets_by_age_to_limit(limit, style
end
end

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def ama_statistics
priority_counts = { count: priority_count }
nonpriority_counts = { count: nonpriority_count }
Expand All @@ -69,19 +67,15 @@ def ama_statistics
nonpriority_counts[sym] = docket.count(priority: false, ready: true)
end

unless FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])
priority_counts[:legacy_hearing_tied_to] = legacy_hearing_priority_count(judge)
nonpriority_counts[:legacy_hearing_tied_to] = legacy_hearing_nonpriority_count(judge)
end
priority_counts[:legacy_hearing_tied_to] = legacy_hearing_priority_count(judge)
nonpriority_counts[:legacy_hearing_tied_to] = legacy_hearing_nonpriority_count(judge)

nonpriority_counts[:iterations] = @nonpriority_iterations

sct_appeals_counts = @appeals.count { |appeal| appeal.try(:sct_appeal) }

settings = {}
feature_toggles = [
:acd_disable_legacy_distributions,
:acd_disable_nonpriority_distributions,
:specialty_case_team_distribution
]
feature_toggles.each do |sym|
Expand Down Expand Up @@ -110,7 +104,7 @@ def ama_statistics
#{error.class}: #{error.message}, #{error.backtrace.first}"
}
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

def ama_distributed_cases_tied_to_ineligible_judges
@appeals.filter_map do |appeal|
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/distribution_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def cancel_previous_judge_assign_task(appeal, judge_id)
# rubocop:disable Metrics/MethodLength
# :reek:FeatureEnvy
def create_sct_appeals(appeals_args, limit)
appeals = appeals(appeals_args)
appeals = ready_priority_nonpriority_appeals(appeals_args)
.limit(limit)
.includes(:request_issues)

Expand Down
2 changes: 0 additions & 2 deletions app/models/distribution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ def judge_tasks
end

def judge_legacy_tasks
return [] if FeatureToggle.enabled?(:acd_disable_legacy_distributions, user: RequestStore.store[:current_user])

legacy_tasks = QueueRepository.tasks_for_user(judge.css_id)

@judge_legacy_tasks ||= legacy_tasks.select { |task| task.assigned_to_attorney_date.nil? }
Expand Down
Loading
Loading