Browse Source

upadte csv export services to retrieve creation method values direct from the log, remove methods previously used from the log model

pull/1738/head
Arthur Campbell 3 years ago
parent
commit
dd1caf5bd1
  1. 8
      app/models/log.rb
  2. 4
      app/services/csv/lettings_log_csv_service.rb
  3. 4
      app/services/csv/sales_log_csv_service.rb

8
app/models/log.rb

@ -178,14 +178,6 @@ class Log < ApplicationRecord
end end
end end
def creation_method_code
bulk_uploaded? ? 2 : 1
end
def creation_method_label
bulk_uploaded? ? "bulk upload" : "single log"
end
def bulk_uploaded? def bulk_uploaded?
bulk_upload_id.present? bulk_upload_id.present?
end end

4
app/services/csv/lettings_log_csv_service.rb

@ -108,8 +108,8 @@ module Csv
codes: %i[scheme id_to_display], codes: %i[scheme id_to_display],
}, },
creation_method: { creation_method: {
labels: %i[creation_method_label], labels: %i[creation_method],
codes: %i[creation_method_code], codes: %i[creation_method_before_type_cast],
}, },
is_dpo: { is_dpo: {
labels: %i[created_by is_dpo?], labels: %i[created_by is_dpo?],

4
app/services/csv/sales_log_csv_service.rb

@ -43,8 +43,8 @@ module Csv
codes: %i[owning_organisation name], codes: %i[owning_organisation name],
}, },
creation_method: { creation_method: {
labels: %i[creation_method_label], labels: %i[creation_method],
codes: %i[creation_method_code], codes: %i[creation_method_before_type_cast],
}, },
}.freeze }.freeze

Loading…
Cancel
Save