Add percentage
This commit is contained in:
parent
0fbe3243c4
commit
824228fe1b
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue