mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
add unrank & star user on scoreboard ui
This commit is contained in:
1 parent
dc0e397d77
commit
b8fd94df50
5 files changed
+48
-11
No files matched your search
@@ -368,7 +368,8 @@ export interface Tdoc<docType = document['TYPE_CONTEST'] | document['TYPE_TRAINI
|
|||||||
unlocked?: boolean;
|
unlocked?: boolean;
|
||||||
access?: number;
|
access?: number;
|
||||||
autoHide?: boolean;
|
autoHide?: boolean;
|
||||||
unrankUsers?: number[];
|
unrankUser?: number[];
|
||||||
|
uninvite?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In hours
|
* In hours
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ const ranked: ranked = async (cursor, equ) => {
|
|||||||
for (const doc of docs) {
|
for (const doc of docs) {
|
||||||
count++;
|
count++;
|
||||||
if (!last || !equ(last, doc)) r = count;
|
if (!last || !equ(last, doc)) r = count;
|
||||||
|
if (doc.unrank) {
|
||||||
|
results.push([0, doc]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
last = doc;
|
last = doc;
|
||||||
results.push([r, doc]);
|
results.push([r, doc]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ const acm = buildContestRule({
|
|||||||
async scoreboardRow(isExport, _, tdoc, pdict, udoc, rank, tsdoc, meta) {
|
async scoreboardRow(isExport, _, tdoc, pdict, udoc, rank, tsdoc, meta) {
|
||||||
const tsddict = tsdoc.detail || {};
|
const tsddict = tsdoc.detail || {};
|
||||||
const row: ScoreboardRow = [
|
const row: ScoreboardRow = [
|
||||||
{ type: 'rank', value: rank.toString() },
|
{ type: 'rank', value: rank ? rank.toString() : '*' },
|
||||||
{ type: 'user', value: udoc.uname, raw: tsdoc.uid },
|
{ type: 'user', value: udoc.uname, raw: tsdoc.uid },
|
||||||
];
|
];
|
||||||
if (isExport) {
|
if (isExport) {
|
||||||
@@ -263,7 +263,7 @@ const oi = buildContestRule({
|
|||||||
async scoreboardRow(isExport, _, tdoc, pdict, udoc, rank, tsdoc, meta) {
|
async scoreboardRow(isExport, _, tdoc, pdict, udoc, rank, tsdoc, meta) {
|
||||||
const tsddict = tsdoc.detail || {};
|
const tsddict = tsdoc.detail || {};
|
||||||
const row: ScoreboardNode[] = [
|
const row: ScoreboardNode[] = [
|
||||||
{ type: 'rank', value: rank.toString() },
|
{ type: 'rank', value: rank ? rank.toString() : '*' },
|
||||||
{ type: 'user', value: udoc.uname, raw: tsdoc.uid },
|
{ type: 'user', value: udoc.uname, raw: tsdoc.uid },
|
||||||
];
|
];
|
||||||
if (isExport) {
|
if (isExport) {
|
||||||
|
|||||||
@@ -127,6 +127,26 @@
|
|||||||
}) }}
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
{{ form.form_text({
|
||||||
|
columns:9,
|
||||||
|
label:'UnRank User',
|
||||||
|
name:'unrankUser',
|
||||||
|
help_text:_('User who will not show rank in scoreboard'),
|
||||||
|
value:tdoc.unrankUser|default(''),
|
||||||
|
row:false
|
||||||
|
}) }}
|
||||||
|
<div style="display: none" class="authorize-settings authorize--invite">
|
||||||
|
{{ form.form_checkbox({
|
||||||
|
columns:3,
|
||||||
|
label:'Allow join by unrank',
|
||||||
|
name:'uninvite',
|
||||||
|
placeholder:_('Allow user join by unrank user without invite code'),
|
||||||
|
value:tdoc.uninvite|default(true),
|
||||||
|
row:false
|
||||||
|
}) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-top: 0" class="section__header">
|
<div style="padding-top: 0" class="section__header">
|
||||||
<h2 class="section__title">{{ _('Contest Settings') }}</h2>
|
<h2 class="section__title">{{ _('Contest Settings') }}</h2>
|
||||||
@@ -134,12 +154,12 @@
|
|||||||
<div class="section__body">
|
<div class="section__body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{ form.form_checkbox({
|
{{ form.form_checkbox({
|
||||||
columns:2,
|
columns:2,
|
||||||
label:'Rated',
|
label:'Rated',
|
||||||
name:'rated',
|
name:'rated',
|
||||||
placeholder:_('Is rated'),
|
placeholder:_('Is rated'),
|
||||||
value:tdoc.rated|default(true),
|
value:tdoc.rated|default(true),
|
||||||
row:false
|
row:false
|
||||||
}) }}
|
}) }}
|
||||||
{{ form.form_checkbox({
|
{{ form.form_checkbox({
|
||||||
columns:3,
|
columns:3,
|
||||||
@@ -164,7 +184,7 @@
|
|||||||
label:'Lock (minutes)',
|
label:'Lock (minutes)',
|
||||||
name:'lock',
|
name:'lock',
|
||||||
placeholder:_('(leave blank if none)'),
|
placeholder:_('(leave blank if none)'),
|
||||||
value:(((tdoc.endAt - tdoc.lockAt)/60000)|int)|default(''),
|
value:(((tdoc.endAt - tdoc.lockAt)/60000)|int) if tdoc.lockAt else '',
|
||||||
help_text:_('Lock scoreboard on last N minutes'),
|
help_text:_('Lock scoreboard on last N minutes'),
|
||||||
disabled:true,
|
disabled:true,
|
||||||
row:false
|
row:false
|
||||||
|
|||||||
@@ -22,12 +22,20 @@
|
|||||||
{% if model.contest.isDone(tdoc) and tdoc.lockAt and handler.user.own(tdoc) and not tdoc.unlocked %}
|
{% if model.contest.isDone(tdoc) and tdoc.lockAt and handler.user.own(tdoc) and not tdoc.unlocked %}
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="hidden" name="operation" value="unlock">
|
<input type="hidden" name="operation" value="unlock">
|
||||||
<button type="submit" class="button" href="{{ url(type + '_scoreboard_download', tid=tdoc.docId, ext='csv') }}">
|
<button type="submit" class="button">
|
||||||
<span class="icon icon-feeling-lucky"></span> {{ _('Unlock scoreboard') }}
|
<span class="icon icon-feeling-lucky"></span> {{ _('Unlock scoreboard') }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class="section__tools">
|
||||||
|
<select class="select" name="list">
|
||||||
|
<option value="all">{{ _('All Users') }}</option>
|
||||||
|
<option value="star">{{ _('Stared Users') }}</option>
|
||||||
|
<option value="unrank">{{ _('Unrank Users') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h1 style="text-align:center" class="section__title">{{ tdoc.title }}</h1>
|
||||||
{% if model.contest.isLocked(tdoc) %}
|
{% if model.contest.isLocked(tdoc) %}
|
||||||
<div class="section__body no-padding">
|
<div class="section__body no-padding">
|
||||||
<blockquote class="note">
|
<blockquote class="note">
|
||||||
@@ -71,6 +79,10 @@
|
|||||||
<td class="col--{{ rows[0][loop.index0]['type'] }}"{% if column.style %} style="{{ column.style }}"{% endif %}>
|
<td class="col--{{ rows[0][loop.index0]['type'] }}"{% if column.style %} style="{{ column.style }}"{% endif %}>
|
||||||
{%- if column.type == 'user' -%}
|
{%- if column.type == 'user' -%}
|
||||||
{%- set canView = canViewAll or handler.user._id == column.raw -%}
|
{%- set canView = canViewAll or handler.user._id == column.raw -%}
|
||||||
|
<button class="star user--{{ colomn.raw }}">
|
||||||
|
<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>
|
||||||
{{ user.render_inline(udict[column.raw], badge=false) }}
|
{{ user.render_inline(udict[column.raw], badge=false) }}
|
||||||
{%- elif column.type == 'record' and column.raw -%}
|
{%- elif column.type == 'record' and column.raw -%}
|
||||||
<a href="{{ url('record_detail', rid=column.raw) if canView else '' }}" data-tooltip="{{ column.hover }}">
|
<a href="{{ url('record_detail', rid=column.raw) if canView else '' }}" data-tooltip="{{ column.hover }}">
|
||||||
|
|||||||
Reference in new issue
Block a user