mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
训练(题单)功能
This commit is contained in:
1 parent
e06283c0cc
commit
97b0d782b9
24 files changed
+466
-105
No files matched your search
@@ -8,7 +8,7 @@
|
||||
{%- endif %}
|
||||
>
|
||||
{%- endif %}
|
||||
{% if pdoc['_id']|string|length < 10 %}P{{ pdoc['_id'] }} {% endif %}{{ pdoc['title'] }}
|
||||
{{ pdoc['pid'] }} {{ pdoc['title'] }}
|
||||
{%- if not invalid %}
|
||||
</a>
|
||||
{%- endif %}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
label:'Title',
|
||||
name:'title',
|
||||
placeholder:_('title'),
|
||||
value:tdoc['title']|default(''),
|
||||
value:tdoc.title|default(''),
|
||||
autofocus:true,
|
||||
row:false
|
||||
}) }}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div>
|
||||
<h2 class="status_title">{{ _(title) }}</h2>
|
||||
</div>
|
||||
<h1>{{ tdoc['title'] }}</h1>
|
||||
<h1>{{ tdoc.title }}</h1>
|
||||
<ul class="info">
|
||||
<li>
|
||||
<span class="icon icon-award"></span>
|
||||
@@ -88,7 +88,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="media__body medium">
|
||||
<h1 class="contest__title"><a href="/c/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<h1 class="contest__title"><a href="/c/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
|
||||
<ul class="supplementary list">
|
||||
<li>
|
||||
<a href="?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ model.contest.RULES[tdoc.rule].TEXT }}</a>
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="medium-3 columns">
|
||||
{% with udoc = udict[ddoc['owner']] %}
|
||||
{% set udoc = udict[ddoc['owner']] %}
|
||||
<div class="section side">
|
||||
<div class="profile__bg user-profile-bg--{{ vj4.model.adaptor.setting.UserSetting(udoc).get_setting('background_img') }}"></div>
|
||||
<div class="section__body">
|
||||
@@ -119,13 +119,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
</div>
|
||||
{% if vnode['doc_type'] == vj4.model.document.TYPE_PROBLEM %}
|
||||
{% with pdoc=vnode, owner_udoc=udict[vnode['owner']] %}
|
||||
{% include "partials/problem_sidebar.html" %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% set pdoc=vnode %}
|
||||
{% set owner_udoc=udict[vnode['owner']] %}
|
||||
{% include "partials/problem_sidebar.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="media__body medium">
|
||||
<h1 class="contest__title"><a href="/c/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<h1 class="contest__title"><a href="/c/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
|
||||
<ul class="supplementary list">
|
||||
<li>
|
||||
<a href="{{ reverse_url('contest_main') }}?rule={{ tdoc['rule'] }}" class="contest-type-tag"><span class="icon icon-award"></span>{{ vj4.constant.contest.RULE_TEXTS[tdoc['rule']] }}</a>
|
||||
@@ -44,7 +44,7 @@
|
||||
<li>
|
||||
<span class="icon icon-user--multiple"></span> {{ tdoc['attend']|default(0) }}
|
||||
</li>
|
||||
{% if tsdict[tdoc['doc_id']]['attend'] == 1 %}
|
||||
{% if tsdict[tdoc._id]['attend'] == 1 %}
|
||||
<li class="contest__info-attended">
|
||||
<span class="icon icon-check"></span> {{ _('Attended') }}
|
||||
</li>
|
||||
@@ -76,7 +76,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="media__body middle">
|
||||
<h1 class="training__title"><a href="{{ reverse_url('training_detail', tid=tdoc['doc_id']) }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<h1 class="training__title"><a href="{{ reverse_url('training_detail', tid=tdoc._id) }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
|
||||
<div class="training__intro typo">
|
||||
<p>{{ tdoc['content'] }}</p>
|
||||
</div>
|
||||
@@ -85,10 +85,10 @@
|
||||
<span class="icon icon-flag text-blue"></span> {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(training.get_pids(tdoc)|length) }}
|
||||
</li>
|
||||
<li>
|
||||
{% if tsdict[tdoc['doc_id']]['enroll'] %}
|
||||
{% if not tsdict[tdoc['doc_id']]['done'] %}
|
||||
{% if tsdict[tdoc._id]['enroll'] %}
|
||||
{% if not tsdict[tdoc._id]['done'] %}
|
||||
<span class="icon training-status--icon progress"></span>
|
||||
<span class="training-status--text progress">{{ _('Completed') }} {{ (100 * tsdict[tdoc['doc_id']]['done_pids']|length / training.get_pids(tdoc)|length)|round|int }}%</span>
|
||||
<span class="training-status--text progress">{{ _('Completed') }} {{ (100 * tsdict[tdoc._id]['done_pids']|length / training.get_pids(tdoc)|length)|round|int }}%</span>
|
||||
{% else %}
|
||||
<span class="icon training-status--icon done"></span>
|
||||
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{% if page_name != 'contest_detail' %}
|
||||
<a class="contest-sidebar__bg" href="/c/{{ tdoc._id }}">
|
||||
<div class="section__body">
|
||||
<h1>{{ tdoc['title'] }}</h1>
|
||||
<h1>{{ tdoc.title }}</h1>
|
||||
<div class="contest-sidebar__status">
|
||||
{% if attended %}
|
||||
<span class="icon icon-check"></span> {{ _('Attended') }}
|
||||
|
||||
@@ -168,13 +168,13 @@
|
||||
{% if tdocs %}
|
||||
<p>{{ _('In following training plans') }}: </p>
|
||||
{% for tdoc in tdocs %}
|
||||
<p><a href="{{ reverse_url('training_detail', tid=tdoc['doc_id']) }}">{{ tdoc['title'] }}</a></p>
|
||||
<p><a href="{{ reverse_url('training_detail', tid=tdoc._id) }}">{{ tdoc.title }}</a></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if ctdocs %}
|
||||
<p>{{ _('In following contests') }}: </p>
|
||||
{% for tdoc in ctdocs %}
|
||||
<p><a href="/c/{{ tdoc._id }}">{{ tdoc['title'] }}</a></p>
|
||||
<p><a href="/c/{{ tdoc._id }}">{{ tdoc.title }}</a></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
{% if tdoc %}
|
||||
<dt>{{ _('Contest') }}</dt>
|
||||
<dd>
|
||||
<a href="/c/{{ tdoc._id }}">{{ tdoc['title'] }}</a>
|
||||
<a href="/c/{{ tdoc._id }}">{{ tdoc.title }}</a>
|
||||
</dd>
|
||||
{% endif %}
|
||||
{% if pdoc and (user._id == pdoc.owner or handler.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% set page_name = "training_detail" %}
|
||||
{% import "components/record.html" as record with context %}
|
||||
{% import "components/problem.html" as problem with context %}
|
||||
{% extends "layout/basic.html" %}
|
||||
@@ -13,7 +14,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
{% if not tsdoc['enroll'] %}
|
||||
{% if not tsdoc.enroll %}
|
||||
<div class="section__body">
|
||||
<blockquote class="typo warn">
|
||||
<p>{{ _('page.training_detail.invalid_when_not_enrolled') }}</p>
|
||||
@@ -21,19 +22,19 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for node in tdoc['dag'] %}
|
||||
<div class="training__section {% if nsdict[node['_id']]['isDone'] %}done{% elif nsdict[node['_id']]['is_progress'] %}progress{% elif nsdict[node['_id']]['is_open'] %}open{% else %}invalid{% endif %} {% if nsdict[node['_id']]['is_progress'] or nsdict[node['_id']]['is_open'] %}expanded{% else %}collapsed{% endif %}">
|
||||
<div class="training__section {% if nsdict[node['_id']]['isDone'] %}done{% elif nsdict[node['_id']]['isProgress'] %}progress{% elif nsdict[node['_id']]['isOpen'] %}open{% else %}invalid{% endif %} {% if nsdict[node['_id']]['isProgress'] or nsdict[node['_id']]['isOpen'] %}expanded{% else %}collapsed{% endif %}">
|
||||
<div class="section__header clearfix">
|
||||
<div class="float-left">
|
||||
<h1 class="section__title">{{ _('Section') }} {{ node['_id'] }}. {{ node['title'] }}</h1>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<h1 class="section__title training-section-status--text {% if nsdict[node['_id']]['isDone'] %}done{% elif nsdict[node['_id']]['is_progress'] %}progress{% elif nsdict[node['_id']]['is_open'] %}open{% else %}invalid{% endif %}">
|
||||
<span class="icon training-section-status--icon {% if nsdict[node['_id']]['isDone'] %}done{% elif nsdict[node['_id']]['is_progress'] %}progress{% elif nsdict[node['_id']]['is_open'] %}open{% else %}invalid{% endif %}"></span>
|
||||
<h1 class="section__title training-section-status--text {% if nsdict[node['_id']]['isDone'] %}done{% elif nsdict[node['_id']]['isProgress'] %}progress{% elif nsdict[node['_id']]['isOpen'] %}open{% else %}invalid{% endif %}">
|
||||
<span class="icon training-section-status--icon {% if nsdict[node['_id']]['isDone'] %}done{% elif nsdict[node['_id']]['isProgress'] %}progress{% elif nsdict[node['_id']]['isOpen'] %}open{% else %}invalid{% endif %}"></span>
|
||||
{% if nsdict[node['_id']]['isDone'] %}
|
||||
{{ _('Completed') }}
|
||||
{% elif nsdict[node['_id']]['is_progress'] %}
|
||||
{% elif nsdict[node['_id']]['isProgress'] %}
|
||||
{{ _('In Progress') }}
|
||||
{% elif nsdict[node['_id']]['is_open'] %}
|
||||
{% elif nsdict[node['_id']]['isOpen'] %}
|
||||
{{ _('Open') }}
|
||||
{% else %}
|
||||
{{ _('Invalid') }}
|
||||
@@ -59,7 +60,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="training__section__detail">
|
||||
{% if nsdict[node['_id']]['is_invalid'] %}
|
||||
{% if nsdict[node['_id']]['isInvalid'] %}
|
||||
<div class="section__body">
|
||||
<blockquote class="typo note">
|
||||
<p>{{ _('This section cannot be challenged at present, so please complete the following sections first') }}:</p>
|
||||
@@ -73,7 +74,7 @@
|
||||
{% endif %}
|
||||
{% if node['content'] %}
|
||||
<div class="section__body typo">
|
||||
{{ node['content']|markdown }}
|
||||
{{ node['content']|markdown|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="section__body no-padding training__problems">
|
||||
@@ -101,7 +102,8 @@
|
||||
<tbody>
|
||||
{% for pid in node['pids'] %}
|
||||
{% if pid in pdict %}
|
||||
{% with pdoc=pdict[pid], psdoc=psdict[pid] %}
|
||||
{% set pdoc=pdict[pid] %}
|
||||
{% set psdoc=psdict[pid] %}
|
||||
<tr>
|
||||
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
{% if psdoc['rid'] %}
|
||||
@@ -125,17 +127,15 @@
|
||||
{{ problem.render_problem_title(
|
||||
pdoc,
|
||||
invalid=not tsdoc['enroll'],
|
||||
show_tags=false,
|
||||
rp=vj4.job.rp.get_rp_expect(pdoc) if (not psdoc or psdoc['status'] != status.STATUS_ACCEPTED) else none
|
||||
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>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
{% with pdoc = {'domain_id': handler.domain_id, 'doc_id': pid, 'hidden': true, 'title': '*'} %}
|
||||
{% set pdoc = {'_id': pid, 'hidden': true, 'title': '*'} %}
|
||||
<tr>
|
||||
<td class="col--status record-status--border">
|
||||
</td>
|
||||
@@ -146,7 +146,6 @@
|
||||
<td class="col--ac_rate">*</td>
|
||||
<td class="col--difficulty">*</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -175,8 +174,8 @@
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if handler.own(tdoc, perm.PERM_EDIT_TRAINING_SELF) or handler.hasPerm(perm.PERM_EDIT_TRAINING) %}
|
||||
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('training_edit', tid=tdoc['doc_id']) }}">
|
||||
{% if tdoc.owner == user._id or handler.hasPerm(perm.PERM_EDIT_TRAINING) %}
|
||||
<li class="menu__item"><a class="menu__link" href="/t/{{ tdoc._id }}/edit">
|
||||
<span class="icon icon-edit"></span> {{ _('Edit') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
@@ -192,7 +191,7 @@
|
||||
<dt>{{ _('Status') }}</dt><dd>{% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}</dd>
|
||||
{% endif %}
|
||||
{% if tsdoc['enroll'] %}
|
||||
<dt>{{ _('Progress') }}</dt><dd>{{ _('Completed') }} {{ (100 * tsdoc['done_pids']|length / pids|length)|round|int }}%</dd>
|
||||
<dt>{{ _('Progress') }}</dt><dd>{{ _('Completed') }} {{ (100 * tsdoc['donePids']|length / pids|length)|round|int }}%</dd>
|
||||
{% endif %}
|
||||
<dt>{{ _('Enrollees') }}</dt><dd>{{ tdoc['enroll']|default(0) }}</dd>
|
||||
<dt>{{ _('Created By') }}</dt>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="medium-5 columns">
|
||||
<label>
|
||||
{{ _('Title') }}
|
||||
<input name="title" placeholder="{{ _('title') }}" value="{{ tdoc['title']|default('') }}" class="textbox" autofocus>
|
||||
<input name="title" placeholder="{{ _('title') }}" value="{{ tdoc.title|default('') }}" class="textbox" autofocus>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{% set page_name = "training_main" %}
|
||||
{% extends "layout/basic.html" %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
@@ -6,7 +7,7 @@
|
||||
<div class="section__header">
|
||||
<h1 class="section__title">{{ _('All Training Plans') }}</h1>
|
||||
</div>
|
||||
{% if not tdocs %}
|
||||
{% if not tdocs.length %}
|
||||
{{ nothing.render('Sorry, there is no training plan.') }}
|
||||
{% else %}
|
||||
<ol class="section__list all primary training__list">
|
||||
@@ -15,24 +16,24 @@
|
||||
<div class="media">
|
||||
<div class="media__left middle">
|
||||
<div class="training__participants numbox">
|
||||
<div class="numbox__num large">{{ tdoc['enroll']|default(0) }}</div>
|
||||
<div class="numbox__num large">{{ tdoc.enroll|default(0) }}</div>
|
||||
<div class="numbox__text">{{ _('Enrolled') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="media__body middle">
|
||||
<h1 class="training__title"><a href="{{ reverse_url('training_detail', tid=tdoc['doc_id']) }}" data-emoji-enabled>{{ tdoc['title'] }}</a></h1>
|
||||
<h1 class="training__title"><a href="/t/{{ tdoc._id }}" data-emoji-enabled>{{ tdoc.title }}</a></h1>
|
||||
<div class="training__intro typo">
|
||||
<p>{{ tdoc['content'] }}</p>
|
||||
</div>
|
||||
<ul class="supplementary list training__progress">
|
||||
<li>
|
||||
<span class="icon icon-flag text-blue"></span> {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(handler.get_pids(tdoc)|length) }}
|
||||
<span class="icon icon-flag text-blue"></span> {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(model.training.getPids(tdoc)|length) }}
|
||||
</li>
|
||||
<li>
|
||||
{% if tsdict[tdoc['doc_id']]['enroll'] %}
|
||||
{% if not tsdict[tdoc['doc_id']]['done'] %}
|
||||
{% if tsdict[tdoc._id]['enroll'] %}
|
||||
{% if not tsdict[tdoc._id]['done'] %}
|
||||
<span class="icon training-status--icon progress"></span>
|
||||
<span class="training-status--text progress">{{ _('Completed') }} {{ (100 * tsdict[tdoc['doc_id']]['done_pids']|length / handler.get_pids(tdoc)|length)|round|int }}%</span>
|
||||
<span class="training-status--text progress">{{ _('Completed') }} {{ (100 * tsdict[tdoc._id]['done_pids']|length / model.training.getPids(tdoc)|length)|round|int }}%</span>
|
||||
{% else %}
|
||||
<span class="icon training-status--icon done"></span>
|
||||
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
|
||||
@@ -59,15 +60,15 @@
|
||||
</div>
|
||||
<div class="section__body">
|
||||
<ol class="my secondary training__list">
|
||||
{% for tsdoc in tsdict.values() %}
|
||||
{% for tsdoc in tsdict %}
|
||||
{% if tsdoc['enroll'] %}
|
||||
<li class="training__item"><div class="media">
|
||||
<div class="media__left">
|
||||
<span class="icon training-status--icon {% if tsdoc['done'] %}done{% else %}progress{% endif %}"></span>
|
||||
</div>
|
||||
<div class="media__body">
|
||||
<h1 class="training__title"><a href="{{ reverse_url('training_detail', tid=tsdoc['doc_id']) }}" data-emoji-enabled>{{ tdict[tsdoc['doc_id']]['title'] }}</a></h1>
|
||||
<div class="supplementary training__progress"><div class="training__progress-bar"><div class="training__progress-track" style="width:{{ (100 * tsdoc['done_pids']|length / handler.get_pids(tdict[tsdoc['doc_id']])|length)|round|int }}%;"></div></div> {{ _('Complete') }} {{ (100 * tsdoc['done_pids']|length / handler.get_pids(tdict[tsdoc['doc_id']])|length)|round|int }}%</div>
|
||||
<h1 class="training__title"><a href="/t/{{ tsdoc.tid }}" data-emoji-enabled>{{ tdict[tsdoc['tid']]['title'] }}</a></h1>
|
||||
<div class="supplementary training__progress"><div class="training__progress-bar"><div class="training__progress-track" style="width:{{ (100 * tsdoc['donePids']|length / model.training.getPids(tdict[tsdoc['tid']])|length)|round|int }}%;"></div></div> {{ _('Complete') }} {{ (100 * tsdoc['done_pids']|length / handler.get_pids(tdict[tsdoc['doc_id']])|length)|round|int }}%</div>
|
||||
</div>
|
||||
</div></li>
|
||||
{% endif %}
|
||||
@@ -83,7 +84,7 @@
|
||||
</div>
|
||||
<ol class="menu">
|
||||
<li class="menu__item">
|
||||
<a href="{{ reverse_url('training_create') }}" class="menu__link"><span class="icon icon-add"></span> {{ _('New Training Plan') }}</a>
|
||||
<a href="/training/create" class="menu__link"><span class="icon icon-add"></span> {{ _('New Training Plan') }}</a>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="section__body">
|
||||
|
||||
Reference in new issue
Block a user