{% extends 'base.html' %}

{% from "_helpers.html" import render_tags, render_delta %}

{% block heading %} Activity Drift Report {% endblock %}
{% block content %}
    <table class="table table-striped table-condensed">
        <thead>
            <tr>
                <th>Day</th>
                <th>Total</th>
                {% for x in range(0,24) %}
                    <th>{{ '{0:0>2}'.format(x) }}</th>
                {% endfor %}
            </tr>
        </thead>
        <tbody>
            {% for date in sleep_drift|sort %}
                <tr>
                    <th>{{ date }}</th>
                    <th>{{ sleep_drift[date].duration }}</th>
                    {% for hour in sleep_drift[date] %}
                        {% if hour.duration %}
                            {% if hour.duration.total_seconds() < 60*30 %}
                                <td style="background: khaki;">&nbsp;</td>
                            {% else %}
                                <td style="background: darkkhaki;">&nbsp;</td>
                            {% endif %}
                        {% else %}
                            {% if hour.is_current %}
                                <td class="label label-info">now</td>
                            {% else %}
                                <td>&nbsp;</td>
                            {% endif %}
                        {% endif %}
                    {% endfor %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}
