mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: add contest score ratio (#765)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
9013c4eaa6
commit
e25db178fd
11 files changed
+121
-23
No files matched your search
@@ -253,6 +253,7 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler {
|
||||
pdict, psdict: {}, udict, rdict: {}, tdoc: this.tdoc, tsdoc: this.tsdoc, tcdocs,
|
||||
};
|
||||
this.response.template = 'contest_problemlist.html';
|
||||
this.response.body.showScore = Object.values(this.tdoc.score || {}).some((i) => i && i !== 100);
|
||||
if (!this.tsdoc) return;
|
||||
if (this.tsdoc.attend && !this.tsdoc.startAt && contest.isOngoing(this.tdoc)) {
|
||||
await contest.setStatus(domainId, tid, this.user._id, { startAt: new Date() });
|
||||
@@ -651,6 +652,16 @@ export class ContestManagementHandler extends ContestManagementBaseHandler {
|
||||
]);
|
||||
this.back();
|
||||
}
|
||||
|
||||
@param('pid', Types.PositiveInt)
|
||||
@param('score', Types.PositiveInt)
|
||||
async postSetScore(domainId: string, pid: number, score: number) {
|
||||
if (!this.tdoc.pids.includes(pid)) throw new ValidationError('pid');
|
||||
this.tdoc.score ||= {};
|
||||
this.tdoc.score[pid] = score;
|
||||
await contest.edit(domainId, this.tdoc.docId, { score: this.tdoc.score });
|
||||
this.back();
|
||||
}
|
||||
}
|
||||
|
||||
export class ContestFileDownloadHandler extends ContestDetailBaseHandler {
|
||||
|
||||
Reference in new issue
Block a user