TMP commit

This commit is contained in:
Bilal
2020-07-09 20:11:57 +02:00
parent a1abd70ae9
commit 5ed930108d
3 changed files with 6 additions and 8 deletions

View File

@@ -21,9 +21,10 @@ class GenerateContractsZipJob < ApplicationJob
zipfile.add(attachment, File.join("#{dir}/", attachment))
end
csv_file = generate_csv releases
puts ">>>>> GENERATED ====="
zipfile.get_output_stream("#{@folder_name}.csv") { |f| f.puts(csv_file) }
if Object.const_get(@release_type).include?(CsvExportable)
csv_file = generate_csv releases
zipfile.get_output_stream("#{@folder_name}.csv") { |f| f.puts(csv_file) }
end
end
@download.file.attach(io: File.open(zipfile_name), filename: "#{@folder_name}.zip")

View File

@@ -25,7 +25,6 @@ module CsvExportable
included do
class << self
def csv_headers
puts "HEADERS ===="
plural_class_name = self.name.underscore.pluralize
headers = HEADERS[self.name.underscore.to_sym]
@@ -36,12 +35,9 @@ module CsvExportable
end
def to_csv_row
puts "==== = CSV ROW"
v = VALUES[self.class.name.underscore.to_sym].map do |function|
VALUES[self.class.name.underscore.to_sym].map do |function|
send(function)
end
puts v
v
end
private

View File

@@ -10,6 +10,7 @@ class LocationRelease < ApplicationRecord
include Syncable
include Taggable
include PersonName
include CsvExportable
composed_of :address,
mapping: [