mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修复contest_record题号显示错误的问题
This commit is contained in:
1 parent
82e33ac958
commit
74cd467bfa
6 files changed
+21
-9
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.29.14",
|
"version": "2.29.15",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -31,11 +31,12 @@ class RecordListHandler extends Handler {
|
|||||||
domainId: string, page = 1, pid?: string, tid?: ObjectID,
|
domainId: string, page = 1, pid?: string, tid?: ObjectID,
|
||||||
uidOrName?: string, status?: number, full = false, all = false,
|
uidOrName?: string, status?: number, full = false, all = false,
|
||||||
) {
|
) {
|
||||||
|
let tdoc = null;
|
||||||
this.response.template = 'record_main.html';
|
this.response.template = 'record_main.html';
|
||||||
const q: FilterQuery<RecordDoc> = { 'contest.tid': tid, hidden: false };
|
const q: FilterQuery<RecordDoc> = { 'contest.tid': tid, hidden: false };
|
||||||
if (full) uidOrName = this.user._id.toString();
|
if (full) uidOrName = this.user._id.toString();
|
||||||
if (tid) {
|
if (tid) {
|
||||||
const tdoc = await contest.get(domainId, tid, -1);
|
tdoc = await contest.get(domainId, tid, -1);
|
||||||
if (!tdoc) throw new ContestNotFoundError(domainId, pid);
|
if (!tdoc) throw new ContestNotFoundError(domainId, pid);
|
||||||
if (!contest.canShowScoreboard.call(this, tdoc, true)) throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
if (!contest.canShowScoreboard.call(this, tdoc, true)) throw new PermissionError(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
||||||
}
|
}
|
||||||
@@ -65,12 +66,13 @@ class RecordListHandler extends Handler {
|
|||||||
canViewProblem
|
canViewProblem
|
||||||
? problem.getList(domainId, rdocs.map(
|
? problem.getList(domainId, rdocs.map(
|
||||||
(rdoc) => (rdoc.domainId === domainId ? rdoc.pid : `${rdoc.pdomain}:${rdoc.pid}`),
|
(rdoc) => (rdoc.domainId === domainId ? rdoc.pid : `${rdoc.pdomain}:${rdoc.pid}`),
|
||||||
), canViewProblemHidden || this.user._id, false)
|
), (!!tid) || canViewProblemHidden || this.user._id, false)
|
||||||
: Object.fromEntries([rdocs.map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])]),
|
: Object.fromEntries([rdocs.map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])]),
|
||||||
]);
|
]);
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
page,
|
page,
|
||||||
rdocs,
|
rdocs,
|
||||||
|
tdoc,
|
||||||
pdict,
|
pdict,
|
||||||
udict,
|
udict,
|
||||||
filterPid: pid,
|
filterPid: pid,
|
||||||
@@ -232,12 +234,19 @@ class RecordMainConnectionHandler extends ConnectionHandler {
|
|||||||
user.getById(this.domainId, rdoc.uid),
|
user.getById(this.domainId, rdoc.uid),
|
||||||
problem.get(this.domainId, rdoc.pid),
|
problem.get(this.domainId, rdoc.pid),
|
||||||
]);
|
]);
|
||||||
if (pdoc) {
|
const tdoc = this.tid ? contest.get(this.domainId, new ObjectID(this.tid)) : null;
|
||||||
|
if (pdoc && !rdoc.contest) {
|
||||||
if (pdoc.hidden && !this.user.own(pdoc) && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
|
if (pdoc.hidden && !this.user.own(pdoc) && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
|
||||||
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) pdoc = null;
|
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) pdoc = null;
|
||||||
}
|
}
|
||||||
if (this.pretest) this.send({ rdoc });
|
if (this.pretest) this.send({ rdoc });
|
||||||
else this.send({ html: await this.renderHTML('record_main_tr.html', { rdoc, udoc, pdoc }) });
|
else {
|
||||||
|
this.send({
|
||||||
|
html: await this.renderHTML('record_main_tr.html', {
|
||||||
|
rdoc, udoc, pdoc, tdoc,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class RecordModel {
|
|||||||
static PROJECTION_LIST: (keyof RecordDoc)[] = [
|
static PROJECTION_LIST: (keyof RecordDoc)[] = [
|
||||||
'_id', 'score', 'time', 'memory', 'lang',
|
'_id', 'score', 'time', 'memory', 'lang',
|
||||||
'uid', 'pid', 'rejudged', 'hidden', 'progress',
|
'uid', 'pid', 'rejudged', 'hidden', 'progress',
|
||||||
'contest', 'judger', 'judgeAt', 'status', 'pdomain',
|
'contest', 'judger', 'judgeAt', 'status', 'domainId',
|
||||||
|
'pdomain',
|
||||||
];
|
];
|
||||||
|
|
||||||
static async submissionPriority(uid: number, base: number = 0) {
|
static async submissionPriority(uid: number, base: number = 0) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.12.7",
|
"version": "4.12.8",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{%- for rdoc in rdocs -%}
|
{%- for rdoc in rdocs -%}
|
||||||
{% set udoc = udict[rdoc['uid']] %}
|
{% set udoc = udict[rdoc['uid']] %}
|
||||||
{% set pdoc = pdict[rdoc['pid']] %}
|
{% set pdoc = pdict[rdoc['pid']] or pdict[rdoc.pdomain + ':' + rdoc.pid] %}
|
||||||
{% include 'record_main_tr.html' %}
|
{% include 'record_main_tr.html' %}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
</button> |
|
</button> |
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if pdoc and (not pdoc.hidden or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN) or handler.user.own(pdoc)) %}
|
{% if pdoc and rdoc.contest %}
|
||||||
|
{{ problem.render_problem_title(pdoc, tdoc=tdoc, show_tags=false, show_invisible_flag=false) }}
|
||||||
|
{% elif pdoc and (not pdoc.hidden or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN) or handler.user.own(pdoc)) %}
|
||||||
{{ problem.render_problem_title(pdoc, show_tags=false) }}
|
{{ problem.render_problem_title(pdoc, show_tags=false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in new issue
Block a user