app/views/badges/_trophy.html.erb
<%
athlete = trophy.athlete
date = trophy.date
%>
<% if @badge.record_kind? %>
<% trophy.info['data'].each do |record| %>
<% next unless (event_name = @country_events.unscope(:order).find_by(id: record['event_id'])&.name) %>
<tr>
<td><%= link_to athlete.name, athlete %></td>
<td><%= event_name %></td>
<% record_result = Result.joins(:activity).where(id: record['result_id']).select(:total_time, :date).take! %>
<td><%= human_result_time record_result[:total_time] %></td>
<td class="hidden-on-phone"><%= l record_result[:date] %></td>
<td class="hidden-on-phone"><%= athlete.club&.name %></td>
</tr>
<% end %>
<% else %>
<tr>
<td><%= link_to athlete.name, athlete %></td>
<% unless @badge.funrun_kind? %>
<td><%= l date if date %></td>
<% end %>
<%= tag.td class: ('hidden-on-phone' unless @badge.funrun_kind?) do %>
<%= athlete.club&.name %>
<% end %>
</tr>
<% end %>