Skip to content

Commit

Permalink
Show cancelled appeals in search and list all cases (#14681)
Browse files Browse the repository at this point in the history
Resolves #14221 

### Description
Removed the filter on Appeals Finder that filtered out Cancelled appeals. 

Search results for finding appeals via File Number will now show cancelled appeals. 
View All Cases on the case details page will also show cancelled appeals.

### Acceptance Criteria
- [x] Cancelled appeals always show in search results
  - [x] Cancelled appeals appear in search results when searching via the Veteran ID 
  - [x] Cancelled appeals appear in search results when searching via the docket ID

### Testing Plan
Search
1. Sign in as a judge or attorney & find an active appeal in your Queue
2. Note the Veteran ID
3. Correct Issues and mark the issues as Removed
4. Go to search and search for the veteran ID, confirm that appeal is returned

View All Cases
1. Sign in as a Judge and find an active appeal with multiple cases in 'View All Cases'
2. Cancel the appeal via removal of the issues
3. Confirm on 'View All Cases' the cancelled appeal is shown

### User Facing Changes
 - [x] Screenshots of UI changes added to PR & Original Issue

Page | BEFORE|AFTER
---|---|---
Case Details View All | ![image](https://user-images.githubusercontent.com/6129479/87164563-e9b41e80-c296-11ea-9fab-79eeb0532dbd.png) | ![image](https://user-images.githubusercontent.com/6129479/87164710-18ca9000-c297-11ea-9070-56c032ab2dc0.png)
Search Results | ![image](https://user-images.githubusercontent.com/6129479/87164598-f6d10d80-c296-11ea-81bf-eef1c588aeb4.png) | ![image](https://user-images.githubusercontent.com/6129479/87164682-0fd9be80-c297-11ea-9b56-bede2ec10573.png)
  • Loading branch information
lomky authored Jul 13, 2020
1 parent 6287312 commit dc3ee83
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/services/appeal_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def find_appeals_with_file_numbers(file_numbers)
MetricsService.record("VACOLS: Get appeal information for file_numbers #{file_numbers}",
service: :queue,
name: "VeteranFinderQuery.find_appeals_with_file_numbers") do
appeals = Appeal.established.where(veteran_file_number: file_numbers).reject(&:removed?).to_a
appeals = Appeal.established.where(veteran_file_number: file_numbers).to_a
begin
appeals.concat(LegacyAppeal.fetch_appeals_by_file_number(*file_numbers))
rescue ActiveRecord::RecordNotFound
Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@
t.boolean "military_sexual_trauma", default: false, comment: "Military Sexual Trauma (MST)"
t.boolean "mustard_gas", default: false
t.boolean "national_cemetery_administration", default: false
t.boolean "no_special_issues", default: false, comment: "Affirmative no special issues, added belatedly"
t.boolean "no_special_issues", default: false, comment: "Affirmative no special issues; column added belatedly"
t.boolean "nonrating_issue", default: false
t.boolean "pension_united_states", default: false
t.boolean "private_attorney_or_agent", default: false
Expand Down
12 changes: 12 additions & 0 deletions spec/factories/appeal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@
end
end

trait :cancelled do
after(:create) do |appeal, _evaluator|
# make sure a request issue exists, then mark all removed
create(:request_issue, decision_review: appeal)
appeal.reload.request_issues.each(&:remove!)

# Cancel the task tree
root_task = RootTask.find_or_create_by!(appeal: appeal, assigned_to: Bva.singleton)
root_task.cancel_task_and_child_subtasks
end
end

trait :denied_advance_on_docket do
established_at { Time.zone.yesterday }
claimants do
Expand Down
4 changes: 2 additions & 2 deletions spec/feature/queue/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def perform_search
let!(:caseflow_appeal) { create(:appeal, veteran: higher_level_review.veteran) }
let!(:removed_request_issue) { create(:request_issue, :removed, decision_review: caseflow_appeal) }

it "does not show removed decision reviews" do
it "does show removed appeals but not removed decision reviews" do
perform_search
expect(page).to have_css(".cf-other-reviews-table > tbody", text: "Supplemental Claim")
expect(page).to_not have_css(".cf-other-reviews-table > tbody", text: "Higher Level Review")
expect(page).to_not have_css(".cf-case-list-table > tbody", text: "Original")
expect(page).to have_css(".cf-case-list-table > tbody", text: "Original")
end
end

Expand Down
12 changes: 12 additions & 0 deletions spec/services/appeal_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@
expect(subject).to be_empty
end
end

context "when the veteran has cancelled appeals" do
let!(:cancelled_appeal) { create(:appeal, :assigned_to_judge, :cancelled, veteran: veteran) }
let(:file_number) { appeal.veteran_file_number }

it "returns the cancelled appeals" do
results = subject

expect(results.count).to eq(3)
expect(results.map(&:id)).to contain_exactly(cancelled_appeal.id, appeal.id, legacy_appeal.id)
end
end
end

describe "#find_appeals_for_veterans" do
Expand Down

0 comments on commit dc3ee83

Please sign in to comment.