mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修复ACM赛制计分
This commit is contained in:
1 parent
a764211eee
commit
7c6e97fdfc
9 files changed
+25
-19
No files matched your search
@@ -150,6 +150,7 @@ Contest scoreboard is not visible.: 当前比赛成绩表隐藏,暂不可显
|
|||||||
Contest Scoreboard: 比赛成绩表
|
Contest Scoreboard: 比赛成绩表
|
||||||
contest_create: 创建比赛
|
contest_create: 创建比赛
|
||||||
contest_detail_problem_submit: 递交比赛题目
|
contest_detail_problem_submit: 递交比赛题目
|
||||||
|
contest_detail_problem: 题目详情
|
||||||
contest_detail: 比赛详情
|
contest_detail: 比赛详情
|
||||||
contest_edit: 编辑比赛
|
contest_edit: 编辑比赛
|
||||||
contest_main: 比赛
|
contest_main: 比赛
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.25.13",
|
"version": "2.25.14",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -307,10 +307,13 @@ export class ContestProblemFileDownloadHandler extends ContestProblemHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
||||||
|
async prepare() {
|
||||||
|
if (!contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
||||||
|
}
|
||||||
|
|
||||||
@param('tid', Types.ObjectID)
|
@param('tid', Types.ObjectID)
|
||||||
@param('pid', Types.UnsignedInt)
|
@param('pid', Types.UnsignedInt)
|
||||||
async prepare(domainId: string, tid: ObjectID, pid: number) {
|
async get(domainId: string, tid: ObjectID, pid: number) {
|
||||||
if (!contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
|
||||||
let rdocs = [];
|
let rdocs = [];
|
||||||
if (contest.canShowRecord.call(this, this.tdoc)) {
|
if (contest.canShowRecord.call(this, this.tdoc)) {
|
||||||
rdocs = await record.getUserInProblemMulti(
|
rdocs = await record.getUserInProblemMulti(
|
||||||
@@ -318,7 +321,6 @@ class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
|||||||
this.pdoc.docId, true,
|
this.pdoc.docId, true,
|
||||||
).sort({ _id: -1 }).limit(10).toArray();
|
).sort({ _id: -1 }).limit(10).toArray();
|
||||||
}
|
}
|
||||||
this.response.template = 'problem_submit.html';
|
|
||||||
const path = [
|
const path = [
|
||||||
['Hydro', 'homepage'],
|
['Hydro', 'homepage'],
|
||||||
['contest_main', 'contest_main'],
|
['contest_main', 'contest_main'],
|
||||||
@@ -335,6 +337,7 @@ class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
|||||||
rdocs,
|
rdocs,
|
||||||
page_name: 'contest_detail_problem_submit',
|
page_name: 'contest_detail_problem_submit',
|
||||||
};
|
};
|
||||||
|
this.response.template = 'problem_submit.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('tid', Types.ObjectID)
|
@param('tid', Types.ObjectID)
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ class RecordDetailHandler extends Handler {
|
|||||||
rdoc,
|
rdoc,
|
||||||
pdoc,
|
pdoc,
|
||||||
};
|
};
|
||||||
|
if (rdoc.contest) {
|
||||||
|
this.response.body.tdoc = await contest.get(domainId, rdoc.contest.tid, rdoc.contest.type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@param('rid', Types.ObjectID)
|
@param('rid', Types.ObjectID)
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ const acm: ContestRule = {
|
|||||||
for (const key in effective) {
|
for (const key in effective) {
|
||||||
const j = effective[key];
|
const j = effective[key];
|
||||||
const real = j.rid.generationTime - Math.floor(tdoc.beginAt.getTime() / 1000);
|
const real = j.rid.generationTime - Math.floor(tdoc.beginAt.getTime() / 1000);
|
||||||
const penalty = 20 * 60 * naccept[j.pid];
|
const penalty = 20 * 60 * (naccept[j.pid] || 0);
|
||||||
detail.push({
|
detail.push({
|
||||||
...j, naccept: naccept[j.pid], time: real + penalty, real, penalty,
|
...j, naccept: naccept[j.pid] || 0, time: real + penalty, real, penalty,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const d of detail) {
|
for (const d of detail) {
|
||||||
@@ -53,7 +53,7 @@ const acm: ContestRule = {
|
|||||||
return { accept, time, detail };
|
return { accept, time, detail };
|
||||||
},
|
},
|
||||||
async scoreboard(isExport, _, tdoc, pdict, cursor, page) {
|
async scoreboard(isExport, _, tdoc, pdict, cursor, page) {
|
||||||
const [rankedTsdocs, nPages] = await ranked(cursor, (a, b) => a.score === b.score, page);
|
const [rankedTsdocs, nPages] = await ranked(cursor, (a, b) => a.score === b.score && a.time === b.time, page);
|
||||||
const uids = rankedTsdocs.map(([, tsdoc]) => tsdoc.uid);
|
const uids = rankedTsdocs.map(([, tsdoc]) => tsdoc.uid);
|
||||||
const udict = await user.getList(tdoc.domainId, uids);
|
const udict = await user.getList(tdoc.domainId, uids);
|
||||||
const columns: ScoreboardRow = [
|
const columns: ScoreboardRow = [
|
||||||
@@ -109,20 +109,21 @@ const acm: ContestRule = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (const pid of tdoc.pids) {
|
for (const pid of tdoc.pids) {
|
||||||
|
const doc = tsddict[pid] || {};
|
||||||
let rid;
|
let rid;
|
||||||
let colAccepted;
|
let colAccepted;
|
||||||
let colTime;
|
let colTime;
|
||||||
let colTimeStr;
|
let colTimeStr;
|
||||||
if (tsddict[pid]?.accept) {
|
if (doc.accept) {
|
||||||
rid = tsddict[pid].rid;
|
rid = doc.rid;
|
||||||
colAccepted = _('Accepted');
|
colAccepted = _('Accepted');
|
||||||
colTime = tsddict[pid].time;
|
colTime = doc.time;
|
||||||
colTimeStr = misc.formatSeconds(colTime);
|
colTimeStr = misc.formatSeconds(colTime) + (doc.naccept ? ` (-${doc.naccept})` : '');
|
||||||
} else {
|
} else {
|
||||||
rid = null;
|
rid = null;
|
||||||
colAccepted = '-';
|
colAccepted = '-';
|
||||||
colTime = '-';
|
colTime = '-';
|
||||||
colTimeStr = '-';
|
colTimeStr = doc.naccept ? `(-${doc.naccept})` : '-';
|
||||||
}
|
}
|
||||||
if (isExport) {
|
if (isExport) {
|
||||||
row.push({ type: 'string', value: colAccepted });
|
row.push({ type: 'string', value: colAccepted });
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||||||
import tpl from 'vj/utils/tpl';
|
import tpl from 'vj/utils/tpl';
|
||||||
import request from 'vj/utils/request';
|
import request from 'vj/utils/request';
|
||||||
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
||||||
import AutoComplete from '.';
|
import AutoComplete from './index';
|
||||||
|
|
||||||
function getText(user) {
|
function getText(user) {
|
||||||
return user.uname;
|
return user.uname;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
|||||||
content = content.split(',');
|
content = content.split(',');
|
||||||
content = content[content.length - 1].trim();
|
content = content[content.length - 1].trim();
|
||||||
}
|
}
|
||||||
if (this.isFocus && content >= this.options.minChar) {
|
if (this.isFocus && content.length >= this.options.minChar) {
|
||||||
if (!this.isOpen) {
|
if (!this.isOpen) {
|
||||||
this.open();
|
this.open();
|
||||||
this.renderList();
|
this.renderList();
|
||||||
@@ -175,9 +175,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
detach() {
|
detach() {
|
||||||
if (this.detached) {
|
if (this.detached) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
super.detach();
|
super.detach();
|
||||||
this.$dom.off(`focus.${this.eventNS}`);
|
this.$dom.off(`focus.${this.eventNS}`);
|
||||||
this.$dom.off(`blur.${this.eventNS}`);
|
this.$dom.off(`blur.${this.eventNS}`);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.8.11",
|
"version": "4.8.12",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function setOptions($el, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const page = new NamedPage('problem_submit', async () => {
|
const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit'], async () => {
|
||||||
$(document).on('click', '[name="problem-sidebar__show-category"]', (ev) => {
|
$(document).on('click', '[name="problem-sidebar__show-category"]', (ev) => {
|
||||||
$(ev.currentTarget).hide();
|
$(ev.currentTarget).hide();
|
||||||
$('[name="problem-sidebar__categories"]').show();
|
$('[name="problem-sidebar__categories"]').show();
|
||||||
|
|||||||
Reference in new issue
Block a user