{% extends "common-content.html" %} {% block meta %} {% endblock %} {% block js_media %} {% endblock %} {% block title_ruler %}{% endblock %} {% block title_row %} {% set tab = 'list' %} {% include "contest/contest-list-tabs.html" %} {% endblock %} {% macro contest_head(contest) %} {% spaceless %} {{- contest.name -}} {% if not contest.is_visible %} {{ _('hidden') }} {% endif %} {% if contest.is_organization_private %} {% for org in contest.organizations.all() %} {{ org.name }} {% endfor %} {% for class in contest.classes.all() %} {{ class.name }} {% endfor %} {% elif contest.is_private %} {{ _('private') }} {% endif %} {% if contest.is_rated %} {{ _('rated') }} {% endif %} {% for tag in contest.tags.all() %} {{- tag.name -}} {% endfor %} {% endspaceless %} {% endmacro %} {% macro time_left(contest) %}
{% if contest.time_limit %} {{ contest.start_time|date(_("M j, Y, G:i")) }} - {{ contest.end_time|date(_("M j, Y, G:i")) }} {% else %} {{ contest.start_time|date(_("M j, Y, G:i")) }} {% endif %}
{% if contest.time_limit %} {% set time_limit=contest.time_limit|timedelta('localized-no-seconds') %} {{ _('%(time_limit)s window', time_limit=time_limit) }} {% else %} {% set duration=contest.contest_window_length|timedelta('localized-no-seconds') %} {{ _('%(duration)s long', duration=duration) }} {% endif %}
{% endmacro %} {% macro user_count(contest, user) %} {% if contest.can_see_own_scoreboard(user) %} {{ contest.user_count }} {% else %} {{ contest.user_count }} {% endif %} {% endmacro %} {% macro contest_join(contest, request, finished_contests) %} {% if not request.in_contest %} {% if contest.is_live_joinable_by(request.user) %}
{% csrf_token %}
{% elif contest.is_spectatable_by(request.user) %}
{% csrf_token %}
{% else %}
{% csrf_token %}
{% endif %} {% endif %} {% endmacro %} {% block body %}
{% if not active_participations and not current_contests and not future_contests and not past_contests %}

Chưa có kỳ thi.

{% endif %} {% if active_participations %}

{{ _('Active contests') }}

{% if not request.in_contest %} {% endif %} {% for participation in active_participations %} {% with contest=participation.contest %} {{ contest_join(contest, request, finished_contests) }} {% endwith %} {% endfor %}
{{ _('Contest') }} {{ _('Users') }}
{{ contest_head(contest) }} {% if contest.start_time %}
{% if contest.time_limit %} {{ _('Window ends in %(countdown)s', countdown=as_countdown(participation.time_remaining)) }} {% elif contest.time_before_end %} {{ _('Ends in %(countdown)s', countdown=as_countdown(contest.time_before_end)) }} {% endif %} {{ time_left(contest) }} {% endif %}
{{ user_count(contest, request.user) }}

{% endif %} {% if current_contests %}

{{ _('Ongoing contests') }}

{% if not request.in_contest %} {% endif %} {% for contest in current_contests %} {{ contest_join(contest, request, finished_contests) }} {% endfor %}
{{ _('Contest') }} {{ _('Users') }}
{{ contest_head(contest) }} {% if contest.start_time %}
{% if contest.time_before_end %} {{ _('Ends in %(countdown)s', countdown=as_countdown(contest.time_before_end)) }} {% endif %} {{ time_left(contest) }} {% endif %}
{{ user_count(contest, request.user) }}

{% endif %}

{{ _('Upcoming contests') }}

{% if future_contests %} {% for contest in future_contests %} {% endfor %}
{{ _('Contest') }}
{{ contest_head(contest) }} {% if contest.start_time %}
{% if contest.time_before_start %} {{ _('Starting in %(countdown)s', countdown=as_countdown(contest.time_before_start)) }} {% endif %} {{ time_left(contest) }} {% endif %}
{% else %} {{ _('There are no scheduled contests at this time.') }}
{% endif %}

{{ _('Past contests') }}

{% if page_obj or search_query %}
{% include "list-pages.html" %}
{% endif %} {% if past_contests %} {% if not request.in_contest %} {% endif %} {% for contest in past_contests %} {% if not request.in_contest %} {% endif %} {% endfor %}
{{ _('Contest') }}{{ sort_order.name }} {{ _('Users') }}{{ sort_order.user_count }}
{{ contest_head(contest) }} {{ time_left(contest) }}
{{ user_count(contest, request.user) }}
{% csrf_token %}
{% if page_obj and page_obj.has_other_pages() %}
{% include "list-pages.html" %}
{% endif %} {% else %} {{ _('There are no past contests.') }}
{% endif %}
{% endblock %}