Browse Source

feat: add scheme csv service

CLDC-3014-schemes-locations-csv-download
natdeanlewissoftwire 1 year ago
parent
commit
313f08a433
  1. 4
      app/jobs/schemes_email_csv_job.rb

4
app/jobs/email_scheme_csv_job.rb → app/jobs/schemes_email_csv_job.rb

@ -1,4 +1,4 @@
class EmailSchemeCsvJob < ApplicationJob
class SchemeEmailCsvJob < ApplicationJob
queue_as :default
BYTE_ORDER_MARK = "\uFEFF".freeze # Required to ensure Excel always reads CSV as UTF-8
@ -6,7 +6,7 @@ class EmailSchemeCsvJob < ApplicationJob
EXPIRATION_TIME = 24.hours.to_i
def perform(user, search_term = nil, filters = {}, all_orgs = false, organisation = nil, download_type = "combined") # rubocop:disable Style/OptionalBooleanParameter - sidekiq can't serialise named params
unfiltered_schemes = organisation.present? && user.support? ? Scheme.where(owning_organisation_id: organisation.id) : user.schemes.visible
unfiltered_schemes = organisation.present? && user.support? ? Scheme.where(owning_organisation_id: organisation.id) : user.schemes
filtered_schemes = FilterManager.filter_schemes(unfiltered_schemes, search_term, filters, all_orgs, user)
case download_type
Loading…
Cancel
Save