Add color to ratings

This commit is contained in:
ricola 2025-04-06 17:04:31 -06:00
parent c4ebe12408
commit 058b512b7d
4 changed files with 13 additions and 5 deletions

View file

@ -16,7 +16,8 @@
<td><%= user.email %></td>
<% @vote.candidates.each do |candidate| %>
<% if rating = @vote.ratings.find { |rating| rating.user == user and rating.candidate == candidate } %>
<td><%= settings.values.select { |e| e[:id] == rating.value }.first[:label] %></td>
<% value = settings.values.select { |e| e[:id] == rating.value }.first %>
<td class="value-<%= value[:id] %>"><%= value[:label] %></td>
<% end %>
<% end %>
</tr>
@ -39,7 +40,8 @@
<tr>
<td><%= i %></td>
<td><%= candidate.name %></td>
<td><%= settings.values.select { |e| e[:id] == candidate.mj.mj }.first[:label] %></td>
<% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %>
<td class="value-<%= value[:id] %>"><%= value[:label] %></td>
<td><%= candidate.mj.proponents %></td>
<td><%= candidate.mj.opponents %></td>
</tr>