vol1ura/Sat_9am_5km

View on GitHub
app/views/activities/_result.html.erb

Summary

Maintainability
Test Coverage
<%= tag.tr data: { male: result.athlete&.male } do %>
  <td class="position align-middle"><%= result.position %></td>
  <td>
    <% if result.athlete_id %>
      <div>
        <%= link_to result.athlete.name.presence || t('common.nobody'), result.athlete, class: 'athlete-link' %>
      </div>
      <div class="athlete-details fw-lighter">
        <%= t '.total_runs_html', count: @results_count[result.athlete_id] %>
        <% if @volunteering_r_count[result.athlete_id] %>
          <div class="vr"></div>
          <%= t '.total_volunteering_html', count: @volunteering_r_count[result.athlete_id] %>
        <% end %>
      </div>
    <% else %>
      <%= t 'common.nobody' %>
    <% end %>
  </td>
  <td class="align-middle text-end">
    <% if result.personal_best %>
      <i class="fa-solid fa-bolt" title="Личный рекорд!"></i>
    <% end %>
    <% if result.first_run %>
      <%= tag.i class: ['fa-solid fa-heart', 'text-success' => @results_count[result.athlete_id] == 1], title: 'Первый забег!' %>
    <% end %>
    <%= human_result_time(result.total_time) %>
  </td>
  <td class="align-middle text-end"><%= human_result_pace(result.total_time) %></td>
  <td class="hidden-on-phone align-middle">
    <% club = result.athlete&.club %>
    <%= link_to club.name, club if club %>
  </td>
<% end %>