summaryrefslogblamecommitdiff
path: root/lib/lsg_web/templates/alcoolog/index.html.eex
blob: e656e6498ea55cd9a7041ce02a8df5109d0db82a (plain) (tree)
1
2
3
4
5
6
7
8
9
                       




                    


                                              
















                                                                                                                         





                                                                                                                                                        
 






                                   
           












                                                                                 
 


                                                                  
<style type="text/css">
ol li {
  margin-bottom: 5px
}
</style>

<%= if @stats == [] do %>
  </strong><i>:o personne ne boit</i></strong>
<% end %>

<ul>
  <%= for {nick, status} <- @stats do %>
    <li><strong><%= nick %> <%= status.user_status %> - <%= status.trend_symbol %> <%= status.active %> g/l</strong><br/>
      &mdash; 15m: <%= status.active15m %> g/l - 30m: <%= status.active30m %> g/l - 1h: <%= status.active1h %> g/l<br />
      &mdash; dernier verre: <%= status.last_type %> <%= status.last_descr %> (<%= status.last_points %>)
      <%= LSGWeb.LayoutView.format_time(status.last_at) %>
      <br />
      &mdash; sobre dans: <%= status.sober_in_s %>
      <br />
      <small>
        &mdash; aujourd'hui: <%= status.daily_volumes %> points, <%= status.daily_gl %> g/l
      </small>
    </li>
  <% end %>
</ul>

<%= if @stats == %{} do %>
  <strong><i>... et personne n'a bu :o :o :o</i></strong>
<% else %>
  <p>
    top consommateur par volume, les 7 derniers jours: <%= Enum.intersperse(for({nick, count} <- @top, do: "#{nick}: #{Float.round(count,4)}"), ", ") %>
  </p>

  <table class="table">
    <thead>
      <tr>
        <th scope="col">date</th>
        <th scope="col">nick</th>
        <th scope="col">points</th>
        <th scope="col">nom</th>
      </tr>
    </thead>
    <tbody>
      <%= for {{{account, date}, points, _, nom, comment}, nick} <- @drinks do %>
          <% date = DateTime.from_unix!(date, :millisecond) %>
          <th scope="row"><%= LSGWeb.LayoutView.format_time(date, false) %></th>
          <td><%= nick %></td>
          <td><%= Float.round(points+0.0, 5) %></td>
          <td><%= nom||"" %> <%= comment||"" %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
<% end %>

<%= if @conn.assigns.account && (@network || @channel) do %>
  <%= link("alcoolog global", to: alcoolog_path(@conn, :index)) %>
<% end %>