Fix: Isolate Report::SurveyItem

speedup-admin-data
Gabe Farrell 2 years ago
parent b08214fe10
commit 37766e777d

@ -85,10 +85,19 @@ module Report
end
FileUtils.mkdir_p Rails.root.join("tmp", "reports")
filepath = Rails.root.join("tmp", "reports", filename)
Measure.write_csv(data:, filepath:)
write_csv(data:, filepath:)
data
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:)
prompt = survey_item.prompt
scale = Scale.find_by_id(survey_item.scale_id)

Loading…
Cancel
Save