{% extends "ox_layout.html" %}
{% block body %}

<div class="w3-light-grey w3-margin-bottom content">
  <p>Minimum task_start_utc = {{ start_utc }}</p>
  <p>Maximum task_end_utc = {{ end_utc }}</p>
  <p>Maximum task count = {{ limit }} <p>
  <p>Provide "?start_utc=YYYY-MM-DD" or "?end_utc=YYYY-MM-DD" or "?limit=N" to filter</p>
</div>

{% for my_status, task_list in task_dict.items() %}
<div class="w3-light-grey w3-margin-bottom w3-row-padding content">
  <details open>
    <summary style="font-size:200%;">
      Tasks with status {{ my_status }} ({{task_list|count}} tasks)
    </summary>
    <TABLE>
      <TH>Task (Click row to expand)</TH>
      <TH>End UTC</TH>
      <TH>Runtime</TH>
    {% for task in task_list %}
    {% if task.task_status == my_status or (
       (my_status == 'other' and task.task_status not in task_types)) %}
      <TR>
	<TD>
	  <details>
	    <summary>
	      Task id {{ task.task_id }} : {{task.task_name}}
	    </summary>
	    <UL>
	      <LI> Name : {{ task.task_name }} </LI>
	      <LI> Start UTC: {{ task.task_start_utc }} </LI> 
	      <LI> End UTC: {{ task.task_end_utc }} </LI> 
	      <LI> Return value: {{ task.return_value }} </LI> 
	      <LI> Status : {{ task.task_status }} </LI>
	      <LI> Runtime : {{ task.run_time() }} </LI>
	    </UL>
	  </details>
	</TD>
	<TD>{{task.task_end_utc}}</TD>
	</TD>
	<TD>{{task.run_time()}}</TD>
      </TR>
      {% endif %}
      {% endfor %}
    </TABLE>
  </details>
</div>
{% endfor %}

{% endblock %}
