From cfcde965fe0415ad51195dea64e141d323f5ea56 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Thu, 15 Oct 2015 01:20:32 +0300 Subject: [PATCH] Export in a more sensible format --- app/views/home/_talk_preference.csv.erb | 4 +++- app/views/home/export.csv.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/home/_talk_preference.csv.erb b/app/views/home/_talk_preference.csv.erb index 961f575..79dff36 100644 --- a/app/views/home/_talk_preference.csv.erb +++ b/app/views/home/_talk_preference.csv.erb @@ -1 +1,3 @@ -<%= CSV.generate_line([talk_preference.hashed_unique_id, talk_preference.created_at] + @talks.map(&:id).map { |talk| talk_preference.include? talk }).html_safe -%> +<% talk_preference.talks.each do |talk| %> + <%= CSV.generate_line([talk_preference.hashed_unique_id, talk_preference.created_at, talk]).html_safe -%> +<% end %> diff --git a/app/views/home/export.csv.erb b/app/views/home/export.csv.erb index ee7483a..56469cb 100644 --- a/app/views/home/export.csv.erb +++ b/app/views/home/export.csv.erb @@ -1,3 +1,3 @@ -<%- headers = ['ID', 'Created at'] + @talks.map(&:id) -%> +<%- headers = ['ID', 'Created at', 'Talk'] -%> <%= CSV.generate_line headers -%> <%= render partial: 'talk_preference', collection: @talk_preferences %>