mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: bug fix
This commit is contained in:
1 parent
53124af10d
commit
eb62a40b01
3 files changed
+6
-5
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.29.12",
|
"version": "2.29.13",
|
||||||
"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",
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ class HomeDomainHandler extends Handler {
|
|||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
['home_domain', null],
|
['home_domain', null],
|
||||||
];
|
];
|
||||||
let ddocs: DomainDoc[];
|
let ddocs: DomainDoc[] = [];
|
||||||
let dudict: Record<string, DomainDoc> = {};
|
let dudict: Record<string, DomainDoc> = {};
|
||||||
if (!this.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) {
|
if (!this.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) {
|
||||||
dudict = await domain.getDictUserByDomainId(this.user._id);
|
dudict = await domain.getDictUserByDomainId(this.user._id);
|
||||||
|
|||||||
@@ -132,13 +132,14 @@ class HomeworkDetailProblemHandler extends Handler {
|
|||||||
this.tdoc = await contest.get(domainId, tid, document.TYPE_HOMEWORK);
|
this.tdoc = await contest.get(domainId, tid, document.TYPE_HOMEWORK);
|
||||||
const pid = this.tdoc.pids[parseInt(_pid, 36) - 10];
|
const pid = this.tdoc.pids[parseInt(_pid, 36) - 10];
|
||||||
if (!pid) throw new ProblemNotFoundError(domainId, tid, _pid);
|
if (!pid) throw new ProblemNotFoundError(domainId, tid, _pid);
|
||||||
const pdomainId = typeof pid === 'string' ? pid.split(':')[0] : domainId;
|
|
||||||
const ppid = typeof pid === 'number' ? pid : +pid.split(':')[1];
|
|
||||||
[this.udoc, this.pdoc, this.tsdoc] = await Promise.all([
|
[this.udoc, this.pdoc, this.tsdoc] = await Promise.all([
|
||||||
user.getById(domainId, this.tdoc.owner),
|
user.getById(domainId, this.tdoc.owner),
|
||||||
problem.get(pdomainId, ppid),
|
problem.get(domainId, pid),
|
||||||
contest.getStatus(domainId, tid, this.user._id, document.TYPE_HOMEWORK),
|
contest.getStatus(domainId, tid, this.user._id, document.TYPE_HOMEWORK),
|
||||||
]);
|
]);
|
||||||
|
if (!this.pdoc) throw new ProblemNotFoundError(domainId, pid);
|
||||||
|
// @ts-ignore
|
||||||
|
if (this.pdoc.domainId !== domainId) this.pdoc.docId = `${this.pdoc.domainId}:${this.pdoc.docId}`;
|
||||||
this.pdoc.pid = _pid;
|
this.pdoc.pid = _pid;
|
||||||
this.attended = this.tsdoc && this.tsdoc.attend === 1;
|
this.attended = this.tsdoc && this.tsdoc.attend === 1;
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
|
|||||||
Reference in new issue
Block a user