mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core&ui: add keep scoreboard hidden option
This commit is contained in:
8 files changed
+30
-26
No files matched your search
@@ -403,12 +403,14 @@ export class ContestEditHandler extends Handler {
|
||||
@param('maintainer', Types.NumericArray, true)
|
||||
@param('allowViewCode', Types.Boolean)
|
||||
@param('allowPrint', Types.Boolean)
|
||||
@param('keepScoreboardHidden', Types.Boolean)
|
||||
@param('langs', Types.CommaSeperatedArray, true)
|
||||
async postUpdate(
|
||||
domainId: string, tid: ObjectId, beginAtDate: string, beginAtTime: string, duration: number,
|
||||
title: string, content: string, rule: string, _pids: string, rated = false,
|
||||
_code = '', autoHide = false, assign: string[] = [], lock: number = null,
|
||||
contestDuration: number = null, maintainer: number[] = [], allowViewCode = false, allowPrint = false, langs: string[] = [],
|
||||
contestDuration: number = null, maintainer: number[] = [], allowViewCode = false, allowPrint = false,
|
||||
keepScoreboardHidden = false, langs: string[] = [],
|
||||
) {
|
||||
if (!Object.keys(contest.RULES).includes(rule) || contest.RULES[rule].hidden) throw new ValidationError('rule');
|
||||
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
||||
@@ -450,7 +452,7 @@ export class ContestEditHandler extends Handler {
|
||||
});
|
||||
}
|
||||
await contest.edit(domainId, tid, {
|
||||
assign, _code, autoHide, lockAt, maintainer, allowViewCode, allowPrint, langs,
|
||||
assign, _code, autoHide, lockAt, maintainer, allowViewCode, allowPrint, keepScoreboardHidden, langs,
|
||||
});
|
||||
this.response.body = { tid };
|
||||
this.response.redirect = this.url('contest_detail', { tid });
|
||||
|
||||
@@ -268,6 +268,7 @@ export interface Tdoc extends Document {
|
||||
privateFiles?: FileInfo[];
|
||||
allowViewCode?: boolean;
|
||||
allowPrint?: boolean;
|
||||
keepScoreboardHidden?: boolean;
|
||||
|
||||
// For contest
|
||||
lockAt?: Date;
|
||||
|
||||
@@ -312,9 +312,9 @@ const oi = buildContestRule({
|
||||
}
|
||||
return { score, detail, display };
|
||||
},
|
||||
showScoreboard: (tdoc, now) => now > tdoc.endAt,
|
||||
showSelfRecord: (tdoc, now) => now > tdoc.endAt,
|
||||
showRecord: (tdoc, now) => now > tdoc.endAt,
|
||||
showScoreboard: (tdoc, now) => now > tdoc.endAt && !tdoc.keepScoreboardHidden,
|
||||
showSelfRecord: (tdoc, now) => now > tdoc.endAt && !tdoc.keepScoreboardHidden,
|
||||
showRecord: (tdoc, now) => now > tdoc.endAt && !tdoc.keepScoreboardHidden,
|
||||
async scoreboardHeader(config, _, tdoc, pdict) {
|
||||
const columns: ScoreboardNode[] = [
|
||||
{ type: 'rank', value: '#' },
|
||||
@@ -477,9 +477,9 @@ const ioi = buildContestRule({
|
||||
const strictioi = buildContestRule({
|
||||
TEXT: 'IOI(Strict)',
|
||||
submitAfterAccept: false,
|
||||
showRecord: (tdoc, now) => now > tdoc.endAt,
|
||||
showSelfRecord: () => true,
|
||||
showScoreboard: (tdoc, now) => now > tdoc.endAt,
|
||||
showRecord: (tdoc, now) => now > tdoc.endAt && !tdoc.keepScoreboardHidden,
|
||||
showSelfRecord: (tdoc) => !tdoc.keepScoreboardHidden || !isDone(tdoc),
|
||||
showScoreboard: (tdoc, now) => now > tdoc.endAt && !tdoc.keepScoreboardHidden,
|
||||
stat(tdoc, journal) {
|
||||
const detail = {};
|
||||
let score = 0;
|
||||
|
||||
Reference in new issue
Block a user