Skip to content

Commit

Permalink
MAP-1421 removed 7 columns from the csv download as per the ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesj2193 committed Jul 25, 2024
1 parent afb078b commit 87d0cd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 28 deletions.
11 changes: 0 additions & 11 deletions app/services/moves/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class Exporter
'Concealed items details',
'Any other risks',
'Any other risks details',
'Special diet or allergy',
'Special diet or allergy details',
'Health issue',
'Health issue details',
'Medication',
Expand All @@ -51,17 +49,12 @@ class Exporter
'Pregnant details',
'Any other requirements',
'Any other requirements details',
'Solicitor or other legal representation',
'Solicitor or other legal representation details',
'Sign or other language interpreter',
'Sign or other language interpreter details',
'Any other information',
'Any other information details',
'Not to be released',
'Not to be released details',
'Requires special vehicle',
'Requires special vehicle details',
'Uploaded documents',
].freeze

def initialize(moves)
Expand Down Expand Up @@ -116,18 +109,14 @@ def attributes_row(move)
answer_details(answers, 'self_harm'), # Self harm details
answer_details(answers, 'concealed_items'), # Concealed items details
answer_details(answers, 'other_risks'), # Any other risks details
answer_details(answers, 'special_diet_or_allergy'), # Special diet or allergy details
answer_details(answers, 'health_issue'), # Health issue details
answer_details(answers, 'medication'), # Medication details
answer_details(answers, 'wheelchair'), # Wheelchair user details
answer_details(answers, 'pregnant'), # Pregnant details
answer_details(answers, 'other_health'), # Any other details
answer_details(answers, 'solicitor'), # Solicitor or other legal representation details
answer_details(answers, 'interpreter'), # Sign or other language interpreter details
answer_details(answers, 'other_court'), # Any other information details
answer_details(answers, 'not_to_be_released'), # Not to be released details
answer_details(answers, 'special_vehicle'), # Requires special vehicle details
profile&.documents&.size || 0, # 'Uploaded documents',
]

if alert_columns
Expand Down
24 changes: 7 additions & 17 deletions spec/services/moves/exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
end

it 'has correct number of header columns' do
expect(header.count).to eq(55)
expect(header.count).to eq(48)
end

it 'has correct number of body columns' do
expect(row.count).to eq(55)
expect(row.count).to eq(48)
end

it 'includes move details' do
Expand Down Expand Up @@ -70,7 +70,7 @@
expect(row).to include('false', '')
end

%w[violent escape hold_separately self_harm concealed_items other_risks special_diet_or_allergy health_issue medication wheelchair pregnant other_health solicitor interpreter other_court not_to_be_released special_vehicle].each do |alert_type|
%w[violent escape hold_separately self_harm concealed_items other_risks health_issue medication wheelchair pregnant other_health interpreter not_to_be_released special_vehicle].each do |alert_type|
it "includes TRUE flag and comments when #{alert_type} is present" do
question.update!(key: alert_type)
move.profile.update!(assessment_answers: [{ assessment_question_id: question.id, comments: 'Yikes!' }])
Expand All @@ -90,16 +90,6 @@
expect(row).to include("Yikes!\n\nBam!")
end

it 'includes move profile documents count' do
create(:document, documentable: move.profile)
expect(row.last).to eq '1'
end

it 'includes 0 documents count if no profile' do
move.person = nil
expect(row.last).to eq '0'
end

context 'with PER' do
let(:framework_questions) do
[
Expand Down Expand Up @@ -135,11 +125,11 @@
end

it 'has correct number of header columns' do
expect(header.count).to eq(57)
expect(header.count).to eq(50)
end

it 'has correct number of body columns' do
expect(row.count).to eq(57)
expect(row.count).to eq(50)
end

it 'has the correct rows' do
Expand All @@ -159,11 +149,11 @@
end

it 'has correct number of header columns' do
expect(header.count).to eq(55)
expect(header.count).to eq(48)
end

it 'has correct number of body columns' do
expect(row.count).to eq(55)
expect(row.count).to eq(48)
end
end
end
Expand Down

0 comments on commit 87d0cd6

Please sign in to comment.