{% extends "layout.html" %}
{% block sidebar %}{% include "lintian-fixes/sidebar.html" %}{% endblock %}
{% from "lintian-fixes/util.html" import lintian_tag_link, lintian_brush_summary %}
{% from "run_util.html" import reschedule_button, display_result_code, publish_buttons %}
{% block page_title %}Lintian Fixes - Developer {{ developer }}{% endblock %}
{% block body %}
<div class="section" id="candidates">
<h1>Lintian Fixes - for developer {{ developer }}</h1>

<table class="docutils">
  <thead>
      <td width="10%">Package</td>
      <td width="50%">Possible Lintian Tags</td>
      <td width="50%">Fixed Lintian Tags</td>
      <td width="25%">Publish</td>
  </thead>

{% for package, (run, candidates, fixed, unfixed, open_proposal_url, status, (queue_position, queue_duration)) in by_package.items() | sort %}
  <tr class="package-{{ status }}">
    <td><a href="/lintian-fixes/pkg/{{ package }}">{{ package }}</a></td>
    <td>
      {% if candidates - fixed %}{% for tag in candidates %}{% if not run or tag not in fixed %}{{ lintian_tag_link(tag) }}{% if not loop.last %} {% endif %}{% endif %}{% endfor %}{% endif %}</td>
    <td>
        {% if run %}
          {% if not run.result_branches and result_code == 'nothing-to-do' %}
            Nothing to do
          {% elif run.result_code in ('success', 'nothing-new-to-do') %}
            {% for tag in fixed %}{{ lintian_tag_link(tag) }}{% if not loop.last %} {% endif %}{% endfor %}
          {% else %}
            {{ display_result_code(run.result_code)|safe }}
          {% endif %}
        {% else %}
          {% if queue_position %}
          <!-- Queued (a {{ format_duration(queue_duration) }} wait) -->
          {{ reschedule_button(suite, package, title='Prioritise', id='reschedule-' + package) }}
          {% else %}
          {{ reschedule_button(suite, package, title='Schedule', id='schedule-' + package) }}
          {% endif %}
        {% endif %}
    </td>
    <td>
      {% if open_proposal_url %}<a href="{{ open_proposal_url }}">proposal</a>
      {% elif run and run.result_branches %}
      {{ publish_buttons(run.suite, run.package, id_suffix='-'+run.package) }}
      {%endif %}
    </td>
  </tr>
{% endfor %}
</table>

</div>
{% endblock %}
