|
|
|
@ -85,10 +85,19 @@ module Report
|
|
|
|
end
|
|
|
|
end
|
|
|
|
FileUtils.mkdir_p Rails.root.join("tmp", "reports")
|
|
|
|
FileUtils.mkdir_p Rails.root.join("tmp", "reports")
|
|
|
|
filepath = Rails.root.join("tmp", "reports", filename)
|
|
|
|
filepath = Rails.root.join("tmp", "reports", filename)
|
|
|
|
Measure.write_csv(data:, filepath:)
|
|
|
|
write_csv(data:, filepath:)
|
|
|
|
data
|
|
|
|
data
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def self.write_csv(data:, filepath:)
|
|
|
|
|
|
|
|
csv = CSV.generate do |csv|
|
|
|
|
|
|
|
|
data.each do |row|
|
|
|
|
|
|
|
|
csv << row
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
File.write(filepath, csv)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.survey_item_info(survey_item:)
|
|
|
|
def self.survey_item_info(survey_item:)
|
|
|
|
prompt = survey_item.prompt
|
|
|
|
prompt = survey_item.prompt
|
|
|
|
scale = Scale.find_by_id(survey_item.scale_id)
|
|
|
|
scale = Scale.find_by_id(survey_item.scale_id)
|
|
|
|
|