mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
修复计分板,完成OI赛制
This commit is contained in:
1 parent
b66ed01fa2
commit
0aa6183804
3 files changed
+12
-18
No files matched your search
@@ -11,9 +11,6 @@ exports.datetime_span = function (dt, relative = true, format = '%Y-%m-%d %H:%M:
|
||||
dt.format(format)
|
||||
);
|
||||
};
|
||||
exports.nl2br = function (self) {
|
||||
return self.replace(/\n/gm, '<br>');
|
||||
};
|
||||
exports.paginate = function* (page, num_pages) {
|
||||
let radius = 2, first, last;
|
||||
if (page > 1) {
|
||||
|
||||
@@ -22,12 +22,14 @@ module.exports = {
|
||||
let columns = [
|
||||
{ type: 'rank', value: _('Rank') },
|
||||
{ type: 'user', value: _('User') },
|
||||
{ type: 'display_name', value: _('Display Name') },
|
||||
{ type: 'total_score', value: _('Total Score') }
|
||||
];
|
||||
for (let i in tdoc.pids)
|
||||
if (is_export)
|
||||
columns.push({ type: 'problem_score', value: '#{0} {1}'.format(i + 1, pdict[tdoc.pids[i]].title) });
|
||||
columns.push({
|
||||
type: 'problem_score',
|
||||
value: '#{0} {1}'.format(i + 1, pdict[tdoc.pids[i]].title)
|
||||
});
|
||||
else
|
||||
columns.push({
|
||||
type: 'problem_detail',
|
||||
@@ -37,13 +39,12 @@ module.exports = {
|
||||
let rows = [columns];
|
||||
for (let [rank, tsdoc] of ranked_tsdocs) {
|
||||
let tsddict = {};
|
||||
if (tdoc.detail)
|
||||
for (let item of tsdoc.detail)
|
||||
if (tsdoc.journal)
|
||||
for (let item of tsdoc.journal)
|
||||
tsddict[item.pid] = item;
|
||||
let row = [];
|
||||
row.push({ type: 'string', value: rank });
|
||||
row.push({ type: 'user', value: udict[tsdoc.uid].uname, raw: udict[tsdoc.uid] });
|
||||
row.push({ type: 'display_name', value: dudict[tsdoc.uid].display_name || '' });
|
||||
row.push({ type: 'string', value: tsdoc.score || 0 });
|
||||
for (let pid of tdoc.pids)
|
||||
row.push({
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<div class="row"><div class="medium-12 columns">
|
||||
<div class="section visible">
|
||||
<div class="section__header">
|
||||
<a class="button" target="_blank" href="{{ reverse_url('contest_scoreboard_download' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_scoreboard_download', tid=tdoc['doc_id'], ext='html') }}">
|
||||
<a class="button" target="_blank" href="/c/{{ tdoc._id }}/export?format=html">
|
||||
<span class="icon icon-download"></span> {{ _('Export as HTML') }}
|
||||
</a>
|
||||
<a class="button" href="{{ reverse_url('contest_scoreboard_download' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_scoreboard_download', tid=tdoc['doc_id'], ext='csv') }}">
|
||||
<a class="button" href="/c/{{ tdoc._id }}/export?format=csv">
|
||||
<span class="icon icon-download"></span> {{ _('Export as CSV') }}
|
||||
</a>
|
||||
</div>
|
||||
@@ -32,20 +32,16 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%- for i, row in rows -%}{% if i>0 %}
|
||||
{%- for row in rows -%}{% if loop.index0>0 %}
|
||||
<tr>
|
||||
{%- for column in row -%}
|
||||
<td class="col--{{ rows[0][loop.index0]['type'] }}">
|
||||
{% if column.type == 'user' %}
|
||||
{{ user.render_inline(column.raw, badge=false) }}
|
||||
{% elif column.type == 'record' %}
|
||||
{% if column.raw %}
|
||||
<a href="/r/{{ column.raw }}">{{ column.value|nl2br }}</a>
|
||||
{% elif column.type == 'record' and column.raw %}
|
||||
<a href="/r/{{ column.raw }}">{{ column.value }}</a>
|
||||
{% else %}
|
||||
{{ column['value']|nl2br }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ column['value']|nl2br }}
|
||||
{{ column.value }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{%- endfor -%}
|
||||
|
||||
Reference in new issue
Block a user