Skip to content

Commit

Permalink
Calculate percentage of rated viewed quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLuptak committed Nov 18, 2017
1 parent 210084f commit fd9b713
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<th>Email</th>
<th>Strategy</th>
<th>Ratings</th>
<th colspan="6"></th>
<th>%</th>
<th colspan="7"></th>
</tr>
</thead>

Expand All @@ -24,6 +25,7 @@
<td><%= user.email %></td>
<td><%= user.strategy.capitalize %></td>
<td><%= user.ratings.count %></td>
<td><%= (user.ratings.count.to_f / (user.viewed_quotes.count.nonzero? || 1) * 100).floor %></td>
<td><%= link_to 'Show', user %></td>
</tr>
<% end %>
Expand Down

0 comments on commit fd9b713

Please sign in to comment.