Browse Source

correct minor error and linting

pull/1268/head
Arthur Campbell 3 years ago
parent
commit
c7c63f6333
  1. 2
      app/jobs/email_csv_job.rb
  2. 6
      app/services/csv/lettings_log_csv_service.rb

2
app/jobs/email_csv_job.rb

@ -12,7 +12,7 @@ class EmailCsvJob < ApplicationJob
filename = organisation.present? ? "logs-#{organisation.name}-#{Time.zone.now}.csv" : "logs-#{Time.zone.now}.csv" filename = organisation.present? ? "logs-#{organisation.name}-#{Time.zone.now}.csv" : "logs-#{Time.zone.now}.csv"
storage_service = Storage::S3Service.new(Configuration::EnvConfigurationService.new, ENV["CSV_DOWNLOAD_PAAS_INSTANCE"]) storage_service = Storage::S3Service.new(Configuration::EnvConfigurationService.new, ENV["CSV_DOWNLOAD_PAAS_INSTANCE"])
storage_service.write_file(filename, BYTE_ORDER_MARK + filtered_logs.to_csv(user, is_codes_only_export)) storage_service.write_file(filename, BYTE_ORDER_MARK + filtered_logs.to_csv(user, is_codes_only_export:))
url = storage_service.get_presigned_url(filename, EXPIRATION_TIME) url = storage_service.get_presigned_url(filename, EXPIRATION_TIME)

6
app/services/csv/lettings_log_csv_service.rb

@ -26,9 +26,9 @@ module Csv
record.send(att) record.send(att)
elsif %w[mrcdate startdate voiddate].include? att elsif %w[mrcdate startdate voiddate].include? att
record.send(att)&.to_formatted_s(:govuk_date) record.send(att)&.to_formatted_s(:govuk_date)
elsif is_codes_only_export && (att.start_with?("location_", "scheme_")) elsif is_codes_only_export && att.start_with?("location_", "scheme_")
att = att + "_before_type_cast" unless %w[location_code scheme_code scheme_owning_organisation_name scheme_created_at location_startdate].include? att att += "_before_type_cast" unless %w[location_code scheme_code scheme_owning_organisation_name scheme_created_at location_startdate].include? att
value = record.send(att) record.send(att)
else else
att = att.remove("_label", "_detail") # a couple of csv column headers have suffixes for the user that are not reflected in the app domain att = att.remove("_label", "_detail") # a couple of csv column headers have suffixes for the user that are not reflected in the app domain
field_value = record.send(att) field_value = record.send(att)

Loading…
Cancel
Save