<%= render 'admin/nav' %>
<% title 'API Usage - Libraries.io' %>
<h1>
  API Usage for <%= Date.today.strftime("%B %Y") %>
</h1>

<table class='table'>
  <thead>
    <th>Email</th>
    <th>Signed up</th>
    <th>Last login</th>
    <th>Optin?</th>
    <th>Requests</th>
  </thead>
  <tbody>
    <% @api_keys.each do |api_key| %>
      <tr>
        <td>
          <%= api_key.user.email %>
        </td>
        <td>
          <%= api_key.user.created_at.to_s(:short) %>
        </td>
        <td>
          <%= api_key.user.last_login_at.try(:to_s, :short) %>
        </td>
        <td>
          <%= fa_icon(api_key.user.optin? ? 'check-circle' : 'times-circle') %>
        </td>
        <td>
          <%= number_to_human @api_key_usage[api_key.id.to_s] %>
        </td>
      </li>
    <% end %>
  </tbody>
</table>

<%= render 'admin/nav' %>
<% title 'API Usage - Libraries.io' %>
<h1>
  API Usage for <%= Date.today.strftime("%B %Y") %>
</h1>

<table class='table'>
  <thead>
    <th>Email</th>
    <th>Signed up</th>
    <th>Last login</th>
    <th>Optin?</th>
    <th>Requests</th>
  </thead>
  <tbody>
    <% @api_keys.each do |api_key| %>
      <tr>
        <td>
          <%= api_key.user.email %>
        </td>
        <td>
          <%= api_key.user.created_at.to_s(:long) %>
        </td>
        <td>
          <%= api_key.user.last_login_at.try(:to_s, :long) %>
        </td>
        <td>
          <%= fa_icon(api_key.user.optin? ? 'check-circle' : 'times-circle') %>
        </td>
        <td>
          <%= number_to_human @api_key_usage[api_key.id.to_s] %>
        </td>
      </li>
    <% end %>
  </tbody>
</table>

Include year in admin api stats dates
Include year in admin api stats dates
