{% extends "squad/base.html" %}
{% load squad %}

{% block content %}

  <h2>
    Test results
    »
    history for <u>{{history.test}}</u>
  </h2>

  <table class='test-results'>

    <thead>
      <th>Build</th>
      <th>Date</th>
      {% for environment in history.environments %}
      <th>{{environment}}</th>
      {% endfor %}
    </thead>

    {% for build, results in history.results.items %}
    <tr>
      <td><a href="{% project_url build %}">{{build.version}}</a></td>
      <td>{{build.datetime}}</td>
      {% for environment in history.environments %}
      {% with result=results|get_value:environment%}
      <td class='{{result.status|slugify}}'>
        {% if result %}
        <a href="{% project_url result.test_run %}">{{result.status}}</a>
        {% else %}
        <i>n/a</i>
        {% endif %}
      </td>
      {% endwith %}
      {% endfor %}
    </tr>
    {% endfor %}

  </table>

{% endblock %}
