Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot authored Apr 11, 2024
2 parents a1d7f9c + fd2f8c8 commit 5ba7559
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/services/claim_fast_tracking/max_rating_annotator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ def self.annotate_disabilities(rated_disabilities_response)
return rated_disabilities_response if diagnostic_codes.empty?

ratings = get_ratings(diagnostic_codes)
if ratings.present?
ratings.each do |rating|
rated_disability = rated_disabilities_response.rated_disabilities.find do |disability|
disability.diagnostic_code == rating['diagnostic_code']
end
rated_disability.maximum_rating_percentage = rating['max_rating'] if rated_disability.present?
end
return rated_disabilities_response unless ratings

ratings_hash = ratings.to_h { |rating| [rating['diagnostic_code'], rating['max_rating']] }
rated_disabilities_response.rated_disabilities.each do |rated_disability|
max_rating = ratings_hash[rated_disability.diagnostic_code]
rated_disability.maximum_rating_percentage = max_rating if max_rating
end
rated_disabilities_response
end
Expand Down
17 changes: 17 additions & 0 deletions spec/services/claim_fast_tracking/max_rating_annotator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@
expect(max_ratings).to eq([10, nil, nil])
end
end

context 'when a disabilities response has two rated disabilities with same diagnostic code' do
let(:disabilities_data) do
[
{ name: 'Tinnitus', diagnostic_code: 6260, rating_percentage: 10 },
{ name: 'Tinnitus', diagnostic_code: 6260, rating_percentage: 10 }
]
end

it 'mutates both rated disabilities with max ratings from VRO' do
VCR.use_cassette('virtual_regional_office/max_ratings') do
subject
max_ratings = disabilities_response.rated_disabilities.map(&:maximum_rating_percentage)
expect(max_ratings).to eq([10, 10])
end
end
end
end

context 'with disability_526_maximum_rating_api_all_conditions enabled' do
Expand Down

0 comments on commit 5ba7559

Please sign in to comment.