core: bug fix

This commit is contained in:
undefined committed 2021-07-02 13:20:40 +08:00
1 parent 53124af10d
commit eb62a40b01
3 files changed
+6 -5

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.29.12",
"version": "2.29.13",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+1 -1
View File
@@ -287,7 +287,7 @@ class HomeDomainHandler extends Handler {
['Hydro', 'homepage'],
['home_domain', null],
];
let ddocs: DomainDoc[];
let ddocs: DomainDoc[] = [];
let dudict: Record<string, DomainDoc> = {};
if (!this.user.hasPriv(PRIV.PRIV_VIEW_ALL_DOMAIN)) {
dudict = await domain.getDictUserByDomainId(this.user._id);
+4 -3
View File
@@ -132,13 +132,14 @@ class HomeworkDetailProblemHandler extends Handler {
this.tdoc = await contest.get(domainId, tid, document.TYPE_HOMEWORK);
const pid = this.tdoc.pids[parseInt(_pid, 36) - 10];
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([
user.getById(domainId, this.tdoc.owner),
problem.get(pdomainId, ppid),
problem.get(domainId, pid),
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.attended = this.tsdoc && this.tsdoc.attend === 1;
this.response.body = {