mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: contest: tsdoc projection for contest
This commit is contained in:
1 parent
8f7d81ddca
commit
dbe369d0c6
9 files changed
+57
-28
No files matched your search
@@ -119,7 +119,7 @@ export class ContestDetailHandler extends ContestDetailBaseHandler {
|
||||
this.response.template = 'contest_detail.html';
|
||||
const udict = await user.getList(domainId, [this.tdoc.owner]);
|
||||
this.response.body = {
|
||||
tdoc: this.tdoc, tsdoc: this.tsdoc, udict,
|
||||
tdoc: this.tdoc, tsdoc: pick(this.tsdoc, ['attend', 'startAt']), udict,
|
||||
};
|
||||
if (!this.request.json) {
|
||||
this.response.body.tdoc.content = this.response.body.tdoc.content
|
||||
|
||||
@@ -2,7 +2,7 @@ import AdmZip from 'adm-zip';
|
||||
import { readFile, statSync } from 'fs-extra';
|
||||
import { isBinaryFile } from 'isbinaryfile';
|
||||
import {
|
||||
escapeRegExp, flattenDeep, intersection, isSafeInteger,
|
||||
escapeRegExp, flattenDeep, intersection, isSafeInteger, pick,
|
||||
} from 'lodash';
|
||||
import { FilterQuery, ObjectID } from 'mongodb';
|
||||
import { nanoid } from 'nanoid';
|
||||
@@ -372,12 +372,12 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
this.response.body = {
|
||||
pdoc: this.pdoc,
|
||||
udoc: this.udoc,
|
||||
psdoc: this.psdoc,
|
||||
psdoc: tid ? null : this.psdoc,
|
||||
title: this.pdoc.title,
|
||||
solutionCount: scnt,
|
||||
discussionCount: dcnt,
|
||||
tdoc: this.tdoc,
|
||||
tsdoc: this.tsdoc,
|
||||
tsdoc: pick(this.tsdoc, ['attend', 'startAt']),
|
||||
};
|
||||
this.response.template = 'problem_detail.html';
|
||||
this.UiContext.extraTitleContent = this.pdoc.title;
|
||||
@@ -429,8 +429,10 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
if (this.psdoc?.rid) {
|
||||
this.response.body.rdoc = await record.get(this.args.domainId, this.psdoc.rid);
|
||||
}
|
||||
this.response.body.ctdocs = await contest.getRelated(this.args.domainId, this.pdoc.docId);
|
||||
this.response.body.htdocs = await contest.getRelated(this.args.domainId, this.pdoc.docId, 'homework');
|
||||
[this.response.body.ctdocs, this.response.body.htdocs] = await Promise.all([
|
||||
contest.getRelated(this.args.domainId, this.pdoc.docId),
|
||||
contest.getRelated(this.args.domainId, this.pdoc.docId, 'homework'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user