mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: fix contestTimer on duration contest (#576)
This commit is contained in:
1 parent
58cab9919d
commit
5b78afeba5
8 files changed
+15
-6
No files matched your search
@@ -179,9 +179,11 @@ export class ContestDetailHandler extends Handler {
|
||||
async get(domainId: string, tid: ObjectId) {
|
||||
this.response.template = 'contest_detail.html';
|
||||
const udict = await user.getList(domainId, [this.tdoc.owner]);
|
||||
const fields = ['attend', 'startAt'];
|
||||
if (this.tdoc.duration) fields.push('endAt');
|
||||
this.response.body = {
|
||||
tdoc: this.tdoc,
|
||||
tsdoc: pick(this.tsdoc, ['attend', 'startAt']),
|
||||
tsdoc: pick(this.tsdoc, fields),
|
||||
udict,
|
||||
files: sortFiles(this.tdoc.files || []),
|
||||
urlForFile: (filename: string) => this.url('contest_file_download', { tid, filename }),
|
||||
@@ -289,8 +291,9 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler {
|
||||
const page_name = this.tdoc.rule === 'homework'
|
||||
? 'homework_scoreboard'
|
||||
: 'contest_scoreboard';
|
||||
const tsdoc = pick(this.tsdoc, ['attend', 'startAt', ...(this.tdoc.duration ? ['endAt'] : [])]);
|
||||
this.response.body = {
|
||||
tdoc: this.tdoc, rows, udict, pdict, page_name, groups,
|
||||
tdoc: this.tdoc, tsdoc, rows, udict, pdict, page_name, groups,
|
||||
};
|
||||
this.response.pjax = 'partials/scoreboard.html';
|
||||
this.response.template = 'contest_scoreboard.html';
|
||||
@@ -614,7 +617,7 @@ export class ContestFileDownloadHandler extends ContestDetailBaseHandler {
|
||||
export class ContestUserHandler extends ContestManagementBaseHandler {
|
||||
@param('tid', Types.ObjectId)
|
||||
async get(domainId: string, tid: ObjectId) {
|
||||
const tsdocs = await contest.getMultiStatus(domainId, { docId: tid }).toArray();
|
||||
const tsdocs = await contest.getMultiStatus(domainId, { docId: tid }).project({ uid: 1, attend: 1, startAt: 1 }).toArray();
|
||||
tsdocs.forEach((i) => {
|
||||
i.endAt = (this.tdoc.duration && i.startAt) ? moment(i.startAt).add(this.tdoc.duration, 'hours').toDate() : null;
|
||||
});
|
||||
|
||||
@@ -371,6 +371,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
};
|
||||
if (this.tdoc && this.tsdoc) {
|
||||
const fields = ['attend', 'startAt'];
|
||||
if (this.tdoc.duration) fields.push('endAt');
|
||||
if (contest.canShowSelfRecord.call(this, this.tdoc, true)) fields.push('detail');
|
||||
this.response.body.tsdoc = pick(this.tsdoc, fields);
|
||||
}
|
||||
|
||||
@@ -222,6 +222,7 @@ class UserLogoutHandler extends Handler {
|
||||
async post() {
|
||||
this.session.uid = 0;
|
||||
this.session.sudo = null;
|
||||
this.session.sudoUid = null;
|
||||
this.session.scope = PERM.PERM_ALL.toString();
|
||||
this.response.redirect = '/';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user