From de87c64c05c0209125d1bc9cf3a3d62f567e127a Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Thu, 15 Oct 2015 21:41:19 +0300 Subject: [PATCH] Percentage to csv --- app/views/home/_talk.csv.erb | 2 +- app/views/home/ratings.csv.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/home/_talk.csv.erb b/app/views/home/_talk.csv.erb index b2a63e8..6cf9741 100644 --- a/app/views/home/_talk.csv.erb +++ b/app/views/home/_talk.csv.erb @@ -1 +1 @@ -<%= CSV.generate_line([talk.id, talk.event_type.name, talk.title, talk.subtitle, @ratings[talk.id]]).html_safe -%> +<%= CSV.generate_line([talk.id, talk.event_type.name, talk.title, talk.subtitle, @ratings[talk.id], "%.2f%" % Rational(100 * @ratings[talk.id], @votes_count).to_f]).html_safe -%> diff --git a/app/views/home/ratings.csv.erb b/app/views/home/ratings.csv.erb index 2a8e6ef..dab9902 100644 --- a/app/views/home/ratings.csv.erb +++ b/app/views/home/ratings.csv.erb @@ -1,3 +1,3 @@ -<%- headers = ['ID', 'Type', 'Title', 'Subtitle', 'Votes'] -%> +<%- headers = ['ID', 'Type', 'Title', 'Subtitle', 'Votes', '%'] -%> <%= CSV.generate_line headers -%> <%= render partial: 'talk', collection: @talks %>