Browse Source

feat: update csv service

pull/2083/head
natdeanlewissoftwire 2 years ago
parent
commit
225249d819
  1. 6
      app/jobs/scheme_email_csv_job.rb
  2. 1
      app/services/csv/scheme_csv_service.rb

6
app/jobs/scheme_email_csv_job.rb

@ -14,12 +14,10 @@ class SchemeEmailCsvJob < ApplicationJob
csv_string = Csv::SchemeCsvService.new(user:).prepare_csv(filtered_schemes)
filename = "#{['schemes', organisation&.name, Time.zone.now].compact.join('-')}.csv"
when "locations"
filtered_locations = filtered_schemes.map(&:locations).flatten
csv_string = Csv::LocationCsvService.new(user:).prepare_csv(filtered_locations)
csv_string = Csv::LocationCsvService.new(user:).prepare_csv(filtered_schemes)
filename = "#{['locations', organisation&.name, Time.zone.now].compact.join('-')}.csv"
when "combined"
filtered_locations = filtered_schemes.map(&:locations).flatten
csv_string = Csv::SchemeAndLocationCsvService.new(user:).prepare_csv(filtered_locations)
csv_string = Csv::SchemeAndLocationCsvService.new(user:).prepare_csv(filtered_schemes)
filename = "#{['schemes-and-locations', organisation&.name, Time.zone.now].compact.join('-')}.csv"
end

1
app/services/csv/scheme_csv_service.rb

@ -45,7 +45,6 @@ module Csv
"scheme_service_name" => %w[service_name],
"scheme_status" => %w[status],
"scheme_sensitive" => %w[sensitive],
"scheme_type" => [],
"scheme_registered_under_care_act" => %w[registered_under_care_act],
"scheme_support_services_provided_by" => %w[arrangement_type],
"scheme_primary_client_group" => %w[primary_client_group],

Loading…
Cancel
Save