{% extends "base.html" %}
{% load staticfiles %}
{% load rowerfilters %}

{% block title %}Workouts{% endblock %}

{% block content %}
<h1>New Workouts Imported From Polar Flow</h1>

<p>Due to a limitation in Polar Flow's API, we can only access new workouts. We
  have imported the following workouts and are now processing them. You will
  receive email when the workouts are ready. </p>

{% if workouts %}
<div class="grid_12 alpha">
<table width="70%" class="listtable">
  <thead>
    <tr>
      <th> Imported </th>
      <th> Date</th>
      <th> Duration </th>
      <th> Distance </th>
      <th> Type</th>
    </tr>
  </thead>
  <tbody>
    {% for workout in workouts %}
    <tr>
      <td>
        {% if workout|lookup:'filename' == '' %}
        NO
        {% else %}
        YES
        {% endif %}
      </td>
      <td>{{ workout|lookup:'starttime' }}</td>
      <td>{{ workout|lookup:'duration' }} </td>
      <td>{{ workout|lookup:'distance' }} m</td>
      <td>{{ workout|lookup:'type' }}</td>
    </tr>
    
    {% endfor %}
  </tbody>
</table>
</div>
{% else %}
<p> No new workouts found </p>
{% endif %}
{% endblock %}
