<commit_before><% page_title 'Competitors' %>

<p>
<%= link_to 'New Competitor', new_admin_competition_competitor_path %>
</p>

<table class='default-table competitors'>
  <thead>
    <tr>
      <th>Name</th>
      <% current_competition.days.each do |day| %>
        <th><%= day.date.strftime("%a")[0,2] %></th>
      <% end %>
      <th>$</th>
      <th>Info</th>
      <th>WCA</th>
      <th>Country</th>
      <th>Email</th>
      <th>Birthday (Age)</th>
      <th>Events</th>
      <th>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% @competitors.each do |competitor| %>
      <tr class="competitor-<%= competitor.state %>">
        <td>
          <%=
            link_to(
              competitor.name,
              edit_admin_competition_competitor_path(current_competition, competitor)
            )
          %>
        </td>
        <% current_competition.days.each do |day| %>
          <td>
            <% if competitor.competing_on?(day) %>
              <%= tooltip(image_tag('cube.png'), "Competing on #{day.date.strftime("%A")}") %>
            <% elsif competitor.guest_on?(day) %>
              <%= tooltip(image_tag('guest.png'), "Guest on #{day.date.strftime("%A")}") %>
            <% end %>
          </td>
        <% end %>
        <td>
          <% if competitor.free_entrance? %>
            <%=
              tooltip(
                image_tag('free_entrance.png'),
                competitor.free_entrance_reason.presence || "Free entrance"
              )
            %>
          <% elsif competitor.paid? %>
            <%=
              tooltip(
                image_tag('free_entrance.png'),
                competitor.paid_comment.presence || "Paid"
              )
            %>
          <% end %>
        </td>
        <td>
          <% if competitor.male? %>
            <%= image_tag('male.png') %>
          <% else %>
            <%= image_tag('female.png') %>
          <% end %>

          <% if competitor.user_comment.present? %>
            <%= tooltip(image_tag('user_comment.png'), competitor.user_comment) %>
          <% end %>

          <% if competitor.admin_comment.present? %>
            <%= tooltip(image_tag('admin_comment.png'), competitor.admin_comment) %>
          <% end %>

          <% if competitor.staff? %>
            <%= tooltip(image_tag('staff.png'), "Staff") %>
          <% end %>

          <% if competitor.nametag.present? %>
            <%= tooltip(image_tag('nametag.png'), competitor.nametag) %>
          <% end %>

          <% if competitor.birthday_on_competition? %>
            <%= tooltip(image_tag('birthday.png'), "Birthday on #{competitor.birthday.strftime("%A")}") %>
          <% end %>

          <% if competitor.event_registrations.select(&:waiting).size > 0 %>
            <%=
              tooltip(
                image_tag('waiting.png'),
                "<b>On waiting list for:</b><br/>" +
                  competitor.event_registrations.waiting.map(&:event).map(&:name).join("<br>\n")
              )
            %>
          <% end %>

          <% if current_competition.city_name && competitor.local? %>
            <%= tooltip(image_tag('local.png'), "#{competitor.name} lives in #{current_competition.city_name}") %>
          <% end %>
        </td>
        <td><%= competitor.wca && link_to(competitor.wca, wca_url(competitor.wca)) %></td>
        <td><%= competitor.country.name %></td>
        <td><%= mail_to(competitor.email) %></td>
        <td><%= competitor.birthday %> (<%= competitor.age %>)</td>
        <td>
          <% counts = competitor.event_registration_counts(true) %>
          <%=
            tooltip(
              "#{counts.join("+")}=#{counts.reduce(:+)}",
              events_by_day_list(competitor)
            )
          %>
        </td>
        <td>
          <%= delete_button('Delete', admin_competition_competitor_path(current_competition, competitor), method: :delete, data: { confirm: 'Are you sure?' }) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table><commit_msg>fix test<commit_after><% page_title 'Competitors' %>

<p>
<%= link_to 'New Competitor', new_admin_competition_competitor_path %>
</p>

<table class='default-table competitors'>
  <thead>
    <tr>
      <th>Name</th>
      <% current_competition.days.each do |day| %>
        <th><%= day.date.strftime("%a")[0,2] %></th>
      <% end %>
      <th>$</th>
      <th>Info</th>
      <th>WCA</th>
      <th>Country</th>
      <th>Email</th>
      <th>Birthday (Age)</th>
      <th>Events</th>
      <th>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% @competitors.each do |competitor| %>
      <tr class="competitor-<%= competitor.state %>">
        <td>
          <%=
            link_to(
              competitor.name,
              edit_admin_competition_competitor_path(current_competition, competitor)
            )
          %>
        </td>
        <% current_competition.days.each do |day| %>
          <td>
            <% if competitor.competing_on?(day) %>
              <%= tooltip(image_tag('cube.png'), "Competing on #{day.date.strftime("%A")}") %>
            <% elsif competitor.guest_on?(day) %>
              <%= tooltip(image_tag('guest.png'), "Guest on #{day.date.strftime("%A")}") %>
            <% end %>
          </td>
        <% end %>
        <td>
          <% if competitor.free_entrance? %>
            <%=
              tooltip(
                image_tag('free_entrance.png'),
                competitor.free_entrance_reason.presence || "Free entrance"
              )
            %>
          <% elsif competitor.paid? %>
            <%=
              tooltip(
                image_tag('free_entrance.png'),
                competitor.paid_comment.presence || "Paid"
              )
            %>
          <% end %>
        </td>
        <td>
          <% if competitor.male? %>
            <%= image_tag('male.png') %>
          <% else %>
            <%= image_tag('female.png') %>
          <% end %>

          <% if competitor.user_comment.present? %>
            <%= tooltip(image_tag('user_comment.png'), competitor.user_comment) %>
          <% end %>

          <% if competitor.admin_comment.present? %>
            <%= tooltip(image_tag('admin_comment.png'), competitor.admin_comment) %>
          <% end %>

          <% if competitor.staff? %>
            <%= tooltip(image_tag('staff.png'), "Staff") %>
          <% end %>

          <% if competitor.nametag.present? %>
            <%= tooltip(image_tag('nametag.png'), competitor.nametag) %>
          <% end %>

          <% if competitor.birthday_on_competition? %>
            <%= tooltip(image_tag('birthday.png'), "Birthday on #{competitor.birthday.strftime("%A")}") %>
          <% end %>

          <% if competitor.event_registrations.select(&:waiting).size > 0 %>
            <%=
              tooltip(
                image_tag('waiting.png'),
                "<b>On waiting list for:</b><br/>" +
                  competitor.event_registrations.waiting.map(&:event).map(&:name).join("<br>\n")
              )
            %>
          <% end %>

          <% if current_competition.city_name && competitor.local? %>
            <%= tooltip(image_tag('local.png'), "#{competitor.name} lives in #{current_competition.city_name}") %>
          <% end %>
        </td>
        <td><%= competitor.wca && link_to(competitor.wca, wca_url(competitor.wca)) %></td>
        <td><%= competitor.country.name %></td>
        <td><%= mail_to(competitor.email) %></td>
        <td><%= competitor.birthday %> (<%= competitor.age %>)</td>
        <td>
          <% counts = competitor.event_registration_counts(true) %>
          <%=
            tooltip(
              "#{counts.join("+")}=#{counts.reduce(:+)}",
              events_by_day_list(competitor)
            )
          %>
        </td>
        <td>
          <%= delete_button(admin_competition_competitor_path(current_competition, competitor), method: :delete, data: { confirm: 'Are you sure?' }) %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>
{'fraction_non_alphanumeric': 0.17945529163039423, 'fraction_numerical': 0.000746175848775028, 'mean_word_length': 1.774060020696792, 'pattern_counts': {'":': 0, '<': 225, '<?xml version=': 0, '>': 227, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2967337', 'n_tokens_mistral': 2767, 'n_tokens_neox': 2496, 'n_words': 347}