Add percentage

This commit is contained in:
Petko Bordjukov 2015-10-15 21:38:46 +03:00
parent 0fbe3243c4
commit 824228fe1b
3 changed files with 3 additions and 0 deletions

View File

@ -5,6 +5,7 @@ class HomeController < ApplicationController
def ratings def ratings
@talks = Talk.ordered_by_rating @talks = Talk.ordered_by_rating
@ratings = Ratings.new @ratings = Ratings.new
@votes_count = TalkPreference.count
end end
def export def export

View File

@ -4,4 +4,5 @@
<td><%= talk.title %></td> <td><%= talk.title %></td>
<td><%= talk.subtitle %></td> <td><%= talk.subtitle %></td>
<td><%= @ratings[talk.id] %></td> <td><%= @ratings[talk.id] %></td>
<td><%= "%.2f%" % Rational(100 * @ratings[talk.id], @votes_count).to_f %></td>
</tr> </tr>

View File

@ -6,6 +6,7 @@
<th>Title</th> <th>Title</th>
<th>Subtitle</th> <th>Subtitle</th>
<th>Votes</th> <th>Votes</th>
<th>%</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>