core: 计量尝试人数而非提交量

suggested by @Menci
This commit is contained in:
undefined committed 2021-06-28 19:57:07 +08:00
1 parent e5d715d02b
commit e49ffa9f7b
17 files changed
+102 -138

No files matched your search

@@ -76,82 +76,82 @@
{{ node['content']|markdown|safe }}
</div>
{% endif %}
<div class="section__body no-padding training__problems">
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.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.user.hasPriv(PRIV.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 pid in node['pids'] -%}
{% if pid in pdict %}
{% set pdoc=pdict[pid] %}
{% set psdoc=psdict[pid] %}
<tr>
{% if handler.user.hasPriv(PRIV.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">
<div class="section__body no-padding training__problems">
<table class="data-table">
<colgroup>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form class="form--inline" action="{{ url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc.docId }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<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>
<col class="col--status">
{% endif %}
{{ problem.render_problem_title(
pdoc,
invalid=not tsdoc['enroll'],
show_tags=false
) }}
</td>
<td class="col--submit_n">{{ pdoc.nSubmit }}</td>
<td class="col--ac_rate">{{ (100 * pdoc.nAccept / pdoc.nSubmit)|round|int if pdoc.nSubmit > 0 else _('?') }}</td>
<td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td>
</tr>
{% else %}
{% set pdoc = {'_id': pid, 'hidden': true, 'title': '*'} %}
<tr>
<td class="col--status record-status--border">
</td>
<td class="col--name col--problem-name">
{{ problem.render_problem_title(pdoc, invalid=true) }}
</td>
<td class="col--submit_n">*</td>
<td class="col--ac_rate">*</td>
<td class="col--difficulty">*</td>
</tr>
{% endif %}
{%- endfor -%}
</tbody>
</table>
<col class="col--name">
<col class="col--submit_n">
<col class="col--ac_rate">
<col class="col--difficulty">
</colgroup>
<thead>
<tr>
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
<th class="col--submit_n">{{ _('Tried') }}</th>
<th class="col--ac_rate">% {{ _('AC') }}</th>
<th class="col--difficulty">{{ _('Difficulty') }}</th>
</tr>
</thead>
<tbody>
{%- for pid in node['pids'] -%}
{% if pid in pdict %}
{% set pdoc=pdict[pid] %}
{% set psdoc=psdict[pid] %}
<tr>
{% if handler.user.hasPriv(PRIV.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.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form class="form--inline" action="{{ url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc.docId }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<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,
invalid=not tsdoc['enroll'],
show_tags=false
) }}
</td>
<td class="col--tried">{{ pdoc.nSubmit }}</td>
<td class="col--ac">{{ pdoc.nAccept }}</td>
<td class="col--difficulty">{{ pdoc['difficulty'] or _('(None)') }}</td>
</tr>
{% else %}
{% set pdoc = {'_id': pid, 'hidden': true, 'title': '*'} %}
<tr>
<td class="col--status record-status--border">
</td>
<td class="col--name col--problem-name">
{{ problem.render_problem_title(pdoc, invalid=true) }}
</td>
<td class="col--submit_n">*</td>
<td class="col--ac_rate">*</td>
<td class="col--difficulty">*</td>
</tr>
{% endif %}
{%- endfor -%}
</tbody>
</table>
</div>
</div>
</div>
</div>
{%- endfor -%}
<div class="section__body">&nbsp;<!-- space placeholder --></div>
</div>