Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extra columns to mileage_export_csv_service #4902

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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