Browse Source

filter out nil elements for vars only defined in future

pull/2982/head
Carolyn 2 months ago
parent
commit
a559513939
  1. 4
      app/services/csv/lettings_log_csv_service.rb
  2. 4
      app/services/csv/sales_log_csv_service.rb

4
app/services/csv/lettings_log_csv_service.rb

@ -285,12 +285,12 @@ module Csv
def lettings_log_definitions
CsvVariableDefinition.lettings.group_by { |record| [record.variable, record.definition] }
.map do |_, options|
.map { |_, options|
exact_match = options.find { |definition| definition.year == @year }
next exact_match if exact_match
options.select { |opt| opt.year < @year }.max_by(&:year)
end
}.compact
end
def insert_derived_and_related_attributes(ordered_questions)

4
app/services/csv/sales_log_csv_service.rb

@ -180,12 +180,12 @@ module Csv
def sales_log_definitions
CsvVariableDefinition.sales.group_by { |record| [record.variable, record.definition] }
.map do |_, options|
.map { |_, options|
exact_match = options.find { |definition| definition.year == @year }
next exact_match if exact_match
options.select { |opt| opt.year < @year }.max_by(&:year)
end
}.compact
end
def insert_derived_and_related_attributes(ordered_questions)

Loading…
Cancel
Save