mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: user_detail: add attended contest (#468)
This commit is contained in:
1 parent
8b26e09fb2
commit
4753621f78
4 files changed
+26
-3
No files matched your search
@@ -12,6 +12,7 @@ import { sendMail } from '../lib/mail';
|
||||
import { isEmail, isPassword } from '../lib/validator';
|
||||
import BlackListModel from '../model/blacklist';
|
||||
import { PERM, PRIV, STATUS } from '../model/builtin';
|
||||
import * as ContestModel from '../model/contest';
|
||||
import domain from '../model/domain';
|
||||
import oauth from '../model/oauth';
|
||||
import * as oplog from '../model/oplog';
|
||||
@@ -356,9 +357,12 @@ class UserDetailHandler extends Handler {
|
||||
}
|
||||
}
|
||||
const tags = Object.entries(acInfo).sort((a, b) => b[1] - a[1]).slice(0, 20);
|
||||
const tsdocs = await ContestModel.getMultiStatus(domainId, { uid: this.user._id, attend: { $exists: true } }).sort({ _id: 1 }).toArray();
|
||||
const tdocs = await ContestModel.getMulti(domainId, { docId: { $in: tsdocs.map((i) => i.docId) } })
|
||||
.project({ docId: 1, title: 1, rule: 1 }).toArray();
|
||||
this.response.template = 'user_detail.html';
|
||||
this.response.body = {
|
||||
isSelfProfile, udoc, sdoc, pdocs, tags,
|
||||
isSelfProfile, udoc, sdoc, pdocs, tags, tdocs,
|
||||
};
|
||||
if (this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION)) {
|
||||
const psdocs = await SolutionModel.getByUser(domainId, uid).limit(10).toArray();
|
||||
|
||||
@@ -83,6 +83,7 @@ API: API
|
||||
Argument {0} is invalid.: 非法的参数 {0} 。
|
||||
Arguments: 参数
|
||||
Assign: 分配给
|
||||
Assignment: 作业
|
||||
At least 4 characters: 至少 4 个字符
|
||||
Attend Contest: 参加比赛
|
||||
Attend contests: 参加比赛
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<li class="section__tab-item">
|
||||
<h1 class="section__tab-title">{{ _('Recent Activities') }}</h1>
|
||||
<div class="section__tab-main">
|
||||
{% if not tdocs.length %}
|
||||
{{ nothing.render("This person is lazy and didn't join any contest or homework") }}
|
||||
{% else %}
|
||||
<div class="typo section__body no-media">
|
||||
<ul>
|
||||
{% for tdoc in tdocs %}
|
||||
<li><a class="contest-type--{{ tdoc.rule }}" href="{{ url('contest_detail' if tdoc.rule !== 'homework' else 'homework_detail', tid=tdoc.docId) }}">
|
||||
{{ tdoc.title }} <span class="contest-type-tag"><span class="icon icon-award"></span>{{ _(model.contest.RULES[tdoc['rule']].TEXT) }}</span>
|
||||
</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
@@ -1,9 +1,9 @@
|
||||
{% if psdocs %}
|
||||
<li class="section__tab-item">
|
||||
<h1 class="section__tab-title">{{ _('Recent solutions') }}</h1>
|
||||
<h1 class="section__tab-title">{{ _('Recent Solutions') }}</h1>
|
||||
<div class="section__tab-main">
|
||||
{% if not psdocs.length %}
|
||||
{{ nothing.render("This person is lazy and wrote any solution") }}
|
||||
{{ nothing.render("This person is lazy and didn't wrote any solution") }}
|
||||
{% else %}
|
||||
<div class="section__body typo no-media">
|
||||
<div class="typo section__body">
|
||||
|
||||
Reference in new issue
Block a user