Created
June 4, 2013 18:03
-
-
Save mrcwinn/5708081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_csv(options={}) | |
header_row = [ | |
'Response ID', | |
'Timestamp (MM/dd/yyyy)', | |
'Time Taken to Complete (Seconds)', | |
] | |
self.questions.each_with_index do |q, i| | |
header_row << "Q#{i+1}" | |
end | |
CSV.generate(options) do |csv| | |
csv << ["Data Export Generated on #{DateTime.now}"] | |
csv << ["Survey ID #{self.uid}"] | |
csv << ["Survey Name #{self.title}"] | |
csv << [] | |
csv << header_row | |
self.questions.each do |question| | |
question.answers.each do |answer| | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment