mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: show homework relate on problem_detail (#396)
This commit is contained in:
1 parent
7101a3096c
commit
008c30c8e0
8 files changed
+26
-5
No files matched your search
@@ -408,6 +408,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -487,9 +487,9 @@ export async function get(domainId: string, tid: ObjectID): Promise<Tdoc<30>> {
|
||||
return tdoc;
|
||||
}
|
||||
|
||||
export async function getRelated(domainId: string, pid: number) {
|
||||
export async function getRelated(domainId: string, pid: number, rule?: string) {
|
||||
const rules = Object.keys(RULES).filter((i) => !RULES[i].hidden);
|
||||
return await document.getMulti(domainId, document.TYPE_CONTEST, { pids: pid, rule: { $in: rules } }).toArray();
|
||||
return await document.getMulti(domainId, document.TYPE_CONTEST, { pids: pid, rule: rule || { $in: rules } }).toArray();
|
||||
}
|
||||
|
||||
export async function getStatus(domainId: string, tid: ObjectID, uid: number) {
|
||||
|
||||
Reference in new issue
Block a user