<commit_before><h2>User Statistics</h2>
<div>
  | <%=  link_to "Total", stats_users_url(:period=>"total"),    :class=>"buttonWarper" %> 
  | <%=  link_to "Hour",  stats_users_url(:period=>"hour"),:class=>"buttonWarper" %> 
  | <%=  link_to "Day",   stats_users_url(:period=>"day"), :class=>"buttonWarper" %> 
  | <%=  link_to "Week",  stats_users_url(:period=>"week"),:class=>"buttonWarper" %> 
  | <%=  link_to "Month",  stats_users_url(:period=>"month"),:class=>"buttonWarper" %> 
  |
</div>
<div class="period">
  <% if @period == "total" %>
  Showing stats from <span class="period">all time</span>.
  <% else %>
  Showing stats for <span class="period">last <%= @period %>.</span>
  <% end %>
</div>

<%= will_paginate @users_activity %>
<table class="usertable">
  <thead>
    <tr>
      <%= sort_header_tag('username', :title => "User") %>
      <%= sort_header_tag('total_count', :title => "Total") %>
      <%= sort_header_tag('map_count', :title => "Total Map Changes") %>
      <%= sort_header_tag('gcp_count', :title => "Total Points Changes") %>
      <%= sort_header_tag('gcp_create_count', :title => "Created Points") %>
      <%= sort_header_tag('gcp_update_count', :title => "Updated Points") %>
      <%= sort_header_tag('gcp_destroy_count', :title => "Deleted Points") %>
      <th>Further Details</th>
    </tr>
  </thead>
  <tbody>

    <% @users_activity.each do | user | %>
      <tr class="<%= cycle('table0', 'table1') -%>">
        <td><% if user.whodunnit 
            user_name = User.select(:login).find_by_id(user.whodunnit).login
          %>
            <%= link_to(user_name, user_path(user.whodunnit))%>
          <% else %>
            Unknown
          <% end %>
        </td>
        <td><%=user.total_count %></td>
        <td><%=user.map_count %></td>
        <td><%=user.gcp_count %></td>
        <td><%=user.gcp_create_count %></td>
        <td><%=user.gcp_update_count %></td>
        <td><%=user.gcp_destroy_count %></td>
        <td>
          <% if user.whodunnit %>
            <%= link_to("User Activity", user_activity_path(user.whodunnit)) %>
          <% else %>
          <% end %>
        </td>
      </tr>
    <% end %>

  </tbody>
</table>
<%= will_paginate @users_activity %>
<commit_msg>fix for user stats where a user has been deleted<commit_after><h2>User Statistics</h2>
<div>
  | <%=  link_to "Total", stats_users_url(:period=>"total"),    :class=>"buttonWarper" %> 
  | <%=  link_to "Hour",  stats_users_url(:period=>"hour"),:class=>"buttonWarper" %> 
  | <%=  link_to "Day",   stats_users_url(:period=>"day"), :class=>"buttonWarper" %> 
  | <%=  link_to "Week",  stats_users_url(:period=>"week"),:class=>"buttonWarper" %> 
  | <%=  link_to "Month",  stats_users_url(:period=>"month"),:class=>"buttonWarper" %> 
  |
</div>
<div class="period">
  <% if @period == "total" %>
  Showing stats from <span class="period">all time</span>.
  <% else %>
  Showing stats for <span class="period">last <%= @period %>.</span>
  <% end %>
</div>

<%= will_paginate @users_activity %>
<table class="usertable">
  <thead>
    <tr>
      <%= sort_header_tag('username', :title => "User") %>
      <%= sort_header_tag('total_count', :title => "Total") %>
      <%= sort_header_tag('map_count', :title => "Total Map Changes") %>
      <%= sort_header_tag('gcp_count', :title => "Total Points Changes") %>
      <%= sort_header_tag('gcp_create_count', :title => "Created Points") %>
      <%= sort_header_tag('gcp_update_count', :title => "Updated Points") %>
      <%= sort_header_tag('gcp_destroy_count', :title => "Deleted Points") %>
      <th>Further Details</th>
    </tr>
  </thead>
  <tbody>

    <% @users_activity.each do | user | %>
      <tr class="<%= cycle('table0', 'table1') -%>">
        <td><% if user.whodunnit && User.exists?(:id => user.whodunnit.to_i)
            user_name = User.select(:login).find_by_id(user.whodunnit).login
          %>
            <%= link_to(user_name, user_path(user.whodunnit))%>
          <% else %>
            Unknown <%="(UserID:#{user.whodunnit})" if user.whodunnit %>
          <% end %>
        </td>
        <td><%=user.total_count %></td>
        <td><%=user.map_count %></td>
        <td><%=user.gcp_count %></td>
        <td><%=user.gcp_create_count %></td>
        <td><%=user.gcp_update_count %></td>
        <td><%=user.gcp_destroy_count %></td>
        <td>
          <% if user.whodunnit %>
            <%= link_to("User Activity", user_activity_path(user.whodunnit)) %>
          <% else %>
          <% end %>
        </td>
      </tr>
    <% end %>

  </tbody>
</table>
<%= will_paginate @users_activity %>

{'fraction_non_alphanumeric': 0.21659085986571366, 'fraction_numerical': 0.0017327268789257093, 'mean_word_length': 3.1158645276292334, 'pattern_counts': {'":': 0, '<': 150, '<?xml version=': 0, '>': 185, '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': '3804709', 'n_tokens_mistral': 1783, 'n_tokens_neox': 1626, 'n_words': 266}