Skip to content

Commit

Permalink
Added extra columns to mileage_export_csv_service (#4902)
Browse files Browse the repository at this point in the history
  • Loading branch information
danaguilar authored Jun 23, 2023
1 parent e13e7b0 commit 8f53179
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/services/mileage_export_csv_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def full_data(case_contact = nil)
miles_driven: case_contact&.miles_driven,
casa_case_number: case_contact&.casa_case&.case_number,
creator_name: case_contact&.creator&.display_name,
supervisor_name: case_contact&.creator&.supervisor&.display_name,
volunteer_address: case_contact&.creator&.address&.content,
reimbursed: case_contact&.reimbursement_complete
}
Expand Down
2 changes: 2 additions & 0 deletions spec/models/mileage_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"Miles Driven",
"Casa Case Number",
"Creator Name",
"Supervisor Name",
"Volunteer Address",
"Reimbursed"
])
Expand All @@ -46,6 +47,7 @@
"Miles Driven",
"Casa Case Number",
"Creator Name",
"Supervisor Name",
"Volunteer Address",
"Reimbursed"
])
Expand Down
3 changes: 2 additions & 1 deletion spec/services/mileage_export_csv_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
"Miles Driven",
"Casa Case Number",
"Creator Name",
"Supervisor Name",
"Volunteer Address",
"Reimbursed"
])
expect(results[1].split(",").count).to eq(8)
expect(results[1].split(",").count).to eq(9)
end
end
5 changes: 4 additions & 1 deletion spec/system/reports/export_data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@
it "downloads mileage report", js: true do
sign_in admin

case_contact_with_mileage = create(:case_contact, want_driving_reimbursement: true, miles_driven: 10)
supervisor = create(:supervisor)
volunteer = create(:volunteer, supervisor: supervisor)
case_contact_with_mileage = create(:case_contact, want_driving_reimbursement: true, miles_driven: 10, creator: volunteer)
case_contact_without_mileage = create(:case_contact)

visit reports_path
Expand All @@ -66,6 +68,7 @@

expect(download_file_name).to match(/mileage-report-\d{4}-\d{2}-\d{2}.csv/)
expect(download_content).to include(case_contact_with_mileage.creator.display_name)
expect(download_content).to include(case_contact_with_mileage.creator.supervisor.display_name)
expect(download_content).not_to include(case_contact_without_mileage.creator.display_name)
end

Expand Down

0 comments on commit 8f53179

Please sign in to comment.