You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/templates/partials/problem_list.html

70 lines
3.0 KiB
HTML

{% import "components/paginator.html" as paginator with context %}
{% import "components/record.html" as record with context %}
{% import "components/problem.html" as problem with context %}
{% import "components/nothing.html" as nothing with context %}
<div data-fragment-id="problem_list">
{% if not pdocs %}
{{ nothing.render('Sorry, there is no problem in the problem set') }}
{% else %}
<table class="data-table">
<colgroup>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
<col class="col--status">
{% endif %}
<col class="col--name">
<col class="col--submit_n">
<col class="col--ac_rate">
<col class="col--difficulty">
</colgroup>
<thead>
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
<th class="col--submit_n">{{ _('Submit') }}</th>
<th class="col--ac_rate">% {{ _('AC') }}</th>
<th class="col--difficulty">{{ _('Difficulty') }}</th>
</tr>
</thead>
<tbody>
{% for pdoc in pdocs %}
{% with psdoc = psdict[pdoc['doc_id']] %}
<tr>
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
<td class="col--status record-status--border">
</td>
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{% if handler.has_priv(vj4.model.builtin.PRIV_USER_PROFILE) %}
<form class="form--inline" action="{{ reverse_url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc['doc_id'] }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button class="star{% if psdoc['star'] %} activated{% endif %}" type="submit">
<span class="starred--hide"><span class="icon icon-star--outline" data-tooltip="{{ _('Star') }}"></span></span>
<span class="starred--show"><span class="icon icon-star" data-tooltip="{{ _('Unstar') }}"></span></span>
</button>
</form>
{% endif %}
{{ problem.render_problem_title(
pdoc,
rp=vj4.job.rp.get_rp_expect(pdoc) if (not psdoc or psdoc['status'] != vj4.constant.record.STATUS_ACCEPTED) else none
) }}
</td>
<td class="col--submit_n">{{ pdoc['num_submit'] }}</td>
<td class="col--ac_rate">{{ (100 * pdoc['num_accept'] / pdoc['num_submit'])|round|int if pdoc['num_submit'] > 0 else _('?') }}</td>
<td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
{{ paginator.render(page, ppcount) }}
{% endif %}
</div>