unb-mds/2023-2-Squad06

View on GitHub
templates/contests/detail.html

Summary

Maintainability
Test Coverage
{% extends "base.html" %}

{% block title %}{{ contest.title }}{% endblock title %}

{% load humanize %}

{% block content %}
  <div>
    <h1>
      <a href="{% url 'contests:detail' contest.id %}">
        {{ contest }}
      </a>
    </h1>
    <hr>
    <p>{{ contest.description }}</p>
  </div>

  <div class="mt-5">
    <h2>Tasks</h2>
    <hr>
    <table class="table table-striped">
      <thead>
        <tr>
          <th class="col">Name</th>
          <th class="col">Score</th>
          <th class="col">Memory limit</th>
          <th class="col">Time limit</th>
        </tr>
      </thead>
      <tbody>
        {% for task in contest.tasks.all %}
        <tr>
          <td>
            {% if task.is_accessible %}
              <a href="{% url 'tasks:detail' task.id %}">
                {{ task }}
              </a>
            {% else %}
              {{ task }}
            {% endif %}
          </td>
          <td>
            {{ task.score|default:"???" }}
          </td>
          <td>
            {% if task.memory_limit %}
              {{ task.memory_limit|filesizeformat }}
            {% else %}
              Unlimited
            {% endif %}
          </td>
          <td>
            {% if task.time_limit %}
              {{ task.time_limit }}
              second{{ task.time_limit|pluralize:"s" }}
            {% else %}
              Unlimited
            {% endif %}
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
{% endblock content %}