diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index ac1cfab..3200952 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -5,6 +5,7 @@ class HomeController < ApplicationController def ratings @talks = Talk.ordered_by_rating @ratings = Ratings.new + @votes_count = TalkPreference.count end def export diff --git a/app/views/home/_talk.html.erb b/app/views/home/_talk.html.erb index c7590ba..8b90eae 100644 --- a/app/views/home/_talk.html.erb +++ b/app/views/home/_talk.html.erb @@ -4,4 +4,5 @@ <%= talk.title %> <%= talk.subtitle %> <%= @ratings[talk.id] %> + <%= "%.2f%" % Rational(100 * @ratings[talk.id], @votes_count).to_f %> diff --git a/app/views/home/ratings.html.erb b/app/views/home/ratings.html.erb index 69161b5..d11a174 100644 --- a/app/views/home/ratings.html.erb +++ b/app/views/home/ratings.html.erb @@ -6,6 +6,7 @@ Title Subtitle Votes + %