Skip to content

Commit

Permalink
more code moved to model
Browse files Browse the repository at this point in the history
  • Loading branch information
mdye committed Jul 31, 2020
1 parent 311dcef commit 2bfe01e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/jobs/create_bulk_download_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,16 @@ def perform(*args)

instrument.vars.each do |var|

var_output_file_name = "#{bd.random_job_id}_instrument_#{var.instrument_id}_var_#{var.id}.csv"
var_output_file_path = "#{BulkDownload.processing_dir}/#{var_output_file_name}"
var_output_file_path = bd.var_temp_output_file_path(var)

zip_file_path = ExportTsPointsToFile.call(
zipped_var_file_path = ExportTsPointsToFile.call(
var,
bd,
var_output_file_path
)

if zip_file_path # Make sure the file is created - it was not if there were no data point
temp_files.push(zip_file_path)
if zipped_var_file_path # Make sure the file is created - it was not if there were no data point
temp_files.push(zipped_var_file_path)
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions app/models/concerns/bulk_download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ def placeholder_file_path
return "#{BulkDownload.tmp_dir}/#{self.final_file_name_base}.temp"
end

def var_temp_output_file_path(var)
var_output_file_name = "#{self.random_job_id}_instrument_#{var.instrument_id}_var_#{var.id}.csv"

var_output_file_path = "#{BulkDownload.processing_dir}/#{var_output_file_name}"

return var_output_file_path
end





def instrument_final_file_name_base(instrument)
Expand Down

0 comments on commit 2bfe01e

Please sign in to comment.