Skip to content

Commit

Permalink
Merge branch 'dev-support/APPEALS-35680' into Al/APPEALS-36565
Browse files Browse the repository at this point in the history
  • Loading branch information
almorbah committed Dec 20, 2023
2 parents 7ea4758 + 92f2655 commit 81b05bd
Show file tree
Hide file tree
Showing 18 changed files with 412 additions and 363 deletions.
41 changes: 40 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,34 @@ Metrics/MethodLength:
Exclude:
- app/jobs/middleware/job_sentry_scope_middleware.rb
- app/jobs/fetch_all_active_ama_appeals_job.rb
- lib/helpers/unrecognized_appellant.rb
- lib/helpers/duplicate_veteran_checker.rb
- lib/helpers/report_load_end_product_sync.rb
- lib/helpers/claim_label_change.rb
- "spec/**/*"

Metrics/ClassLength:
Max: 400
Exclude:
- lib/helpers/duplicate_veteran_checker.rb

Metrics/AbcSize:
Max: 30
Exclude:
- app/jobs/virtual_hearings/create_conference_job.rb
- app/jobs/fetch_all_active_ama_appeals_job.rb
- lib/helpers/duplicate_veteran_checker.rb

Metrics/CyclomaticComplexity:
Exclude:
- app/services/virtual_hearings/resend_virtual_hearing_emails_service.rb
- app/jobs/fetch_all_active_ama_appeals_job.rb
- lib/helpers/duplicate_veteran_checker.rb

Metrics/PerceivedComplexity:
Exclude:
- app/jobs/fetch_all_active_ama_appeals_job.rb

- lib/helpers/duplicate_veteran_checker.rb

Style/DoubleNegation:
Enabled: false
Expand Down Expand Up @@ -160,6 +168,21 @@ Style/FormatStringToken:
Enabled: true
EnforcedStyle: annotated

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/HashTransformValues:
Enabled: true

Style/ExponentialNotation:
Enabled: true

Style/SlicingWithRange:
Enabled: true

Naming/FileName:
Enabled: false

Expand All @@ -180,8 +203,24 @@ Lint/UnusedMethodArgument:
Exclude:
- 'lib/fakes/*.rb'

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

Layout/LineLength:
Max: 120
Exclude:
- lib/helpers/duplicate_veteran_checker.rb
- lib/helpers/report_load_end_product_sync.rb


Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true

Layout/SpaceAroundMethodCallOperator:
Enabled: true
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
source ENV["GEM_SERVER_URL"] || "https://rubygems.org"

# State machine
Expand Down Expand Up @@ -116,7 +116,7 @@ group :test, :development, :demo do
gem "rspec-rails"
# For CircleCI test metadata analysis
gem "rspec_junit_formatter"
gem "rubocop", "= 0.79", require: false
gem "rubocop", "= 0.83", require: false
gem "rubocop-performance"
gem "rubocop-rails"
gem "scss_lint", require: false
Expand Down Expand Up @@ -145,11 +145,11 @@ end

group :test do
gem "knapsack_pro", "~> 3.8"
gem "rspec-github", require: false
# For retrying failed feature tests. Read more: https://github.com/NoRedInk/rspec-retry
gem "rspec-retry"
gem "webmock"
gem "rspec-github", require: false
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength

gem "json_schemer", "~> 0.2.16"
26 changes: 13 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ GEM
activerecord (>= 4.2.0)
anbt-sql-formatter (0.1.0)
arel (9.0.0)
ast (2.4.0)
ast (2.4.2)
aws-sdk (2.10.112)
aws-sdk-resources (= 2.10.112)
aws-sdk-core (2.10.112)
Expand Down Expand Up @@ -348,7 +348,7 @@ GEM
ice_cube (0.16.3)
immigrant (0.3.6)
activerecord (>= 3.0)
jaro_winkler (1.5.4)
jaro_winkler (1.5.6)
jmespath (1.3.1)
jquery-rails (4.5.1)
rails-dom-testing (>= 1, < 3)
Expand Down Expand Up @@ -454,11 +454,11 @@ GEM
paper_trail (12.3.0)
activerecord (>= 5.2)
request_store (~> 1.1)
parallel (1.19.1)
parallel (1.23.0)
paranoia (2.4.2)
activerecord (>= 4.0, < 6.1)
parser (2.7.0.5)
ast (~> 2.4.0)
parser (2.7.2.0)
ast (~> 2.4.1)
pdf-forms (1.2.0)
cliver (~> 0.3.2)
safe_shell (>= 1.0.3, < 2.0)
Expand Down Expand Up @@ -513,7 +513,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rainbow (3.1.1)
rake (12.3.3)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
Expand Down Expand Up @@ -555,7 +555,7 @@ GEM
rack (>= 1.4)
reverse_markdown (1.4.0)
nokogiri
rexml (3.2.5)
rexml (3.2.6)
roo (2.8.2)
nokogiri (~> 1)
rubyzip (>= 1.2.1, < 2.0.0)
Expand Down Expand Up @@ -586,13 +586,13 @@ GEM
rspec-support (3.9.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.79.0)
jaro_winkler (~> 1.5.1)
rubocop (0.83.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-performance (1.5.2)
rubocop (>= 0.71.0)
rubocop-rails (2.5.0)
Expand All @@ -605,7 +605,7 @@ GEM
ruby-oci8 (2.2.7)
ruby-plsql (0.7.1)
ruby-prof (1.4.1)
ruby-progressbar (1.10.1)
ruby-progressbar (1.13.0)
ruby_dep (1.5.0)
ruby_parser (3.20.3)
sexp_processor (~> 4.16)
Expand Down Expand Up @@ -691,7 +691,7 @@ GEM
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.1)
unicode-display_width (1.8.0)
unicode_utils (1.4.0)
uniform_notifier (1.12.1)
uri_template (0.7.0)
Expand Down Expand Up @@ -809,7 +809,7 @@ DEPENDENCIES
rspec-rails
rspec-retry
rspec_junit_formatter
rubocop (= 0.79)
rubocop (= 0.83)
rubocop-performance
rubocop-rails
ruby-debug-ide
Expand Down
37 changes: 24 additions & 13 deletions app/controllers/appeals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def show_case_list
end
end

# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def fetch_notification_list
appeals_id = params[:appeals_id]
respond_to do |format|
Expand All @@ -63,9 +64,10 @@ def fetch_notification_list
begin
if !appeal.nil?
pdf = PdfExportService.create_and_save_pdf("notification_report_pdf_template", appeal)
send_data pdf, filename: "Notification Report " + appeals_id + " " + date + ".pdf", type: "application/pdf", disposition: :attachment
pdf_file_name = "Notification Report " + appeals_id + " " + date + ".pdf"
send_data pdf, filename: pdf_file_name, type: "application/pdf", disposition: :attachment
else
raise ActionController::RoutingError.new('Appeal Not Found')
fail ActionController::RoutingError, "Appeal Not Found"
end
rescue StandardError => error
uuid = SecureRandom.uuid
Expand All @@ -75,13 +77,14 @@ def fetch_notification_list
end
end
format.csv do
raise ActionController::ParameterMissing.new('Bad Format')
fail ActionController::ParameterMissing, "Bad Format"
end
format.html do
raise ActionController::ParameterMissing.new('Bad Format')
fail ActionController::ParameterMissing, "Bad Format"
end
end
end
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize

def document_count
doc_count = EFolderService.document_count(appeal.veteran_file_number, current_user)
Expand Down Expand Up @@ -291,13 +294,15 @@ def send_initial_notification_letter
when "direct_review"
parent_task = @appeal.tasks.find_by(type: "DistributionTask")
end
@send_initial_notification_letter ||= @appeal.tasks.open.find_by(type: :SendInitialNotificationLetterTask) ||
SendInitialNotificationLetterTask.create!(
appeal: @appeal,
parent: parent_task,
assigned_to: Organization.find_by_url("clerk-of-the-board"),
assigned_by: RequestStore[:current_user]
) unless parent_task.nil?
unless parent_task.nil?
@send_initial_notification_letter ||= @appeal.tasks.open.find_by(type: :SendInitialNotificationLetterTask) ||
SendInitialNotificationLetterTask.create!(
appeal: @appeal,
parent: parent_task,
assigned_to: Organization.find_by_url("clerk-of-the-board"),
assigned_by: RequestStore[:current_user]
)
end
end

def power_of_attorney_data
Expand All @@ -320,9 +325,15 @@ def find_notifications_by_appeals_id(appeals_id)
# Retrieve notifications based on appeals_id, excluding statuses of 'No participant_id' & 'No claimant'
@all_notifications = Notification.where(appeals_id: appeals_id)
@allowed_notifications = @all_notifications.where(email_notification_status: nil)
.or(@all_notifications.where.not(email_notification_status: ["No Participant Id Found", "No Claimant Found", "No External Id"]))
.or(@all_notifications.where.not(
email_notification_status: ["No Participant Id Found", "No Claimant Found", "No External Id"]
))
.merge(@all_notifications.where(sms_notification_status: nil)
.or(@all_notifications.where.not(sms_notification_status: ["No Participant Id Found", "No Claimant Found", "No External Id"])))
.or(@all_notifications.where.not(sms_notification_status: [
"No Participant Id Found",
"No Claimant Found",
"No External Id"
])))
# If no notifications were found, return an empty array, else return serialized notifications
if @allowed_notifications == []
[]
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/fetch_all_active_ama_appeals_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def map_appeal_privacy_act_state(appeal)
# Params: Appeal object
# Returns: Hash of "hearing scheduled" key value pair
def map_appeal_hearing_scheduled_state(appeal)
if (appeal&.hearings&.count&.> 0) && appeal.hearings.max_by(&:id).disposition.nil?
if (appeal&.hearings&.count > 0) && appeal.hearings.max_by(&:id).disposition.nil?
return { hearing_scheduled: true }
end

Expand Down
2 changes: 0 additions & 2 deletions app/jobs/quarterly_metrics_report_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def perform

private

# rubocop:disable Metrics/LineLength
def additional_metrics
hearings_show_rate = Metrics::HearingsShowRate.new(Metrics::DateRange.new(start_date, end_date))
ep_creation_rate = Metrics::NonDenialDecisions.new(Metrics::DateRange.new(start_date, end_date))
Expand All @@ -25,5 +24,4 @@ def additional_metrics
"Mean time to recovery: See the 'Quarterly OIT Report' tab of the 'Caseflow Incident Stats' Google Sheet (https://docs.google.com/spreadsheets/d/1OAx_eRhwTaEM9aMx7eGg4KMR3Jgx5wYvsVBypHsZq5Q/edit#gid=593310513)"
]
end
# rubocop:enable Metrics/LineLength
end
4 changes: 2 additions & 2 deletions app/jobs/recurring_metrics_report_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def additional_metrics
[]
end

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
def build_report(appeals, async_stats, certification_metric)
certification_paperless_metric = certification_metric.call[:paperless_metric]
sc_stats = async_stats.stats[:supplemental_claims]
Expand All @@ -53,5 +53,5 @@ def build_report(appeals, async_stats, certification_metric)
report << async_stats.as_csv
report.join("\n")
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
end
4 changes: 2 additions & 2 deletions app/models/legacy_appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class UnknownLocationError < StandardError; end
end

# Note: If any of the names here are changed, they must also be changed in SpecialIssues.js 'specialIssue` value
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
SPECIAL_ISSUES = {
contaminated_water_at_camp_lejeune: "Contaminated Water at Camp LeJeune",
dic_death_or_accrued_benefits_united_states: "DIC - death, or accrued benefits - United States",
Expand Down Expand Up @@ -140,7 +140,7 @@ class UnknownLocationError < StandardError; end
vocational_rehab: "Vocational Rehabilitation and Employment",
waiver_of_overpayment: "Waiver of Overpayment"
}.freeze
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength

# Codes for Appeals Status API
TYPE_CODES = {
Expand Down
4 changes: 2 additions & 2 deletions app/models/vacols/case_issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def attributes_for_readjudication
}
end

# rubocop:disable MethodLength
# rubocop:disable Metrics/MethodLength

# Issues can be labeled by looking up the combination of ISSPROG,
# ISSCODE, ISSLEV1, ISSLEV2, and ISSLEV3 in the ISSREF table.
Expand Down Expand Up @@ -109,7 +109,7 @@ def self.descriptions(vacols_ids)
memo
end
end
# rubocop:enable MethodLength
# rubocop:enable Metrics/MethodLength

def self.create_issue!(issue_attrs)
create!(issue_attrs.merge(issseq: generate_sequence_id(issue_attrs[:isskey])))
Expand Down
Loading

0 comments on commit 81b05bd

Please sign in to comment.