mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: contest correction mode
This commit is contained in:
10 files changed
+56
-16
No files matched your search
@@ -207,9 +207,18 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler {
|
||||
const psdocs: any[] = Object.values(this.response.body.psdict);
|
||||
const canViewRecord = contest.canShowSelfRecord.call(this, this.tdoc);
|
||||
this.response.body.canViewRecord = canViewRecord;
|
||||
const rids = psdocs.map((i) => i.rid);
|
||||
if (contest.isDone(this.tdoc) && canViewRecord) {
|
||||
const correction = await problem.getListStatus(domainId, this.user._id, this.tdoc.pids);
|
||||
for (const pid in correction) {
|
||||
if (this.tsdoc.detail[pid]?.rid === correction[pid].rid) delete correction[pid];
|
||||
}
|
||||
rids.push(...Object.values(correction).map((i) => i.rid));
|
||||
this.response.body.correction = correction;
|
||||
}
|
||||
[this.response.body.rdict, this.response.body.rdocs] = canViewRecord
|
||||
? await Promise.all([
|
||||
record.getList(domainId, psdocs.map((i: any) => i.rid)),
|
||||
record.getList(domainId, rids),
|
||||
record.getMulti(domainId, { contest: tid, uid: this.user._id })
|
||||
.sort({ _id: -1 }).toArray(),
|
||||
])
|
||||
|
||||
@@ -334,6 +334,10 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
discussionCount: dcnt,
|
||||
tdoc: this.tdoc,
|
||||
owner_udoc: (tid && this.tdoc.owner !== this.pdoc.owner) ? await user.getById(domainId, this.tdoc.owner) : null,
|
||||
mode: !tid ? 'normal'
|
||||
: !this.tsdoc?.attend ? 'view'
|
||||
: !contest.isDone(this.tdoc) ? 'contest'
|
||||
: problem.canViewBy(this.pdoc, this.user) ? 'correction' : 'none',
|
||||
};
|
||||
if (this.tdoc && this.tsdoc) {
|
||||
const fields = ['attend', 'startAt'];
|
||||
@@ -802,7 +806,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
||||
@param('filename', Types.Filename)
|
||||
@param('noDisposition', Types.Boolean)
|
||||
@query('tid', Types.ObjectId, true)
|
||||
async get(domainId: string, type = 'additional_file', filename: string, noDisposition = false, tid: ObjectId) {
|
||||
async get({ }, type = 'additional_file', filename: string, noDisposition = false, tid: ObjectId) {
|
||||
if (!tid) this.checkPerm(PERM.PERM_VIEW_PROBLEM);
|
||||
if (this.pdoc.reference) {
|
||||
if (type === 'testdata') throw new ProblemIsReferencedError('download testdata');
|
||||
|
||||
Reference in new issue
Block a user