Don't write a file if there's an empty dataset

rpp-main
rebuilt 3 years ago
parent 8f0deab53b
commit 02a2c6cd97

@ -43,12 +43,14 @@ class Cleaner
end end
end end
unless data.empty?
filename = filename(headers:, data:) filename = filename(headers:, data:)
write_csv(data: clean_csv, output_filepath:, filename:) write_csv(data: clean_csv, output_filepath:, filename:)
write_csv(data: log_csv, output_filepath: log_filepath, prefix: 'removed.', filename:) write_csv(data: log_csv, output_filepath: log_filepath, prefix: 'removed.', filename:)
end end
end end
end end
end
def filename(headers:, data:) def filename(headers:, data:)
survey_item_ids = headers.filter(&:present?).filter do |header| survey_item_ids = headers.filter(&:present?).filter do |header|

Loading…
Cancel
Save