mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +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_create: 创建比赛
|
||||
contest_detail_problem_submit: 递交比赛题目
|
||||
contest_detail_problem: 题目详情
|
||||
contest_detail: 比赛详情
|
||||
contest_edit: 编辑比赛
|
||||
contest_main: 比赛
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.25.13",
|
||||
"version": "2.25.14",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -307,10 +307,13 @@ export class ContestProblemFileDownloadHandler extends ContestProblemHandler {
|
||||
}
|
||||
|
||||
class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
||||
async prepare() {
|
||||
if (!contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
@param('pid', Types.UnsignedInt)
|
||||
async prepare(domainId: string, tid: ObjectID, pid: number) {
|
||||
if (!contest.isOngoing(this.tdoc)) throw new ContestNotLiveError(this.tdoc.docId);
|
||||
async get(domainId: string, tid: ObjectID, pid: number) {
|
||||
let rdocs = [];
|
||||
if (contest.canShowRecord.call(this, this.tdoc)) {
|
||||
rdocs = await record.getUserInProblemMulti(
|
||||
@@ -318,7 +321,6 @@ class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
||||
this.pdoc.docId, true,
|
||||
).sort({ _id: -1 }).limit(10).toArray();
|
||||
}
|
||||
this.response.template = 'problem_submit.html';
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['contest_main', 'contest_main'],
|
||||
@@ -335,6 +337,7 @@ class ContestDetailProblemSubmitHandler extends ContestProblemHandler {
|
||||
rdocs,
|
||||
page_name: 'contest_detail_problem_submit',
|
||||
};
|
||||
this.response.template = 'problem_submit.html';
|
||||
}
|
||||
|
||||
@param('tid', Types.ObjectID)
|
||||
|
||||
@@ -117,6 +117,9 @@ class RecordDetailHandler extends Handler {
|
||||
rdoc,
|
||||
pdoc,
|
||||
};
|
||||
if (rdoc.contest) {
|
||||
this.response.body.tdoc = await contest.get(domainId, rdoc.contest.tid, rdoc.contest.type);
|
||||
}
|
||||
}
|
||||
|
||||
@param('rid', Types.ObjectID)
|
||||
|
||||
@@ -39,9 +39,9 @@ const acm: ContestRule = {
|
||||
for (const key in effective) {
|
||||
const j = effective[key];
|
||||
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({
|
||||
...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) {
|
||||
@@ -53,7 +53,7 @@ const acm: ContestRule = {
|
||||
return { accept, time, detail };
|
||||
},
|
||||
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 udict = await user.getList(tdoc.domainId, uids);
|
||||
const columns: ScoreboardRow = [
|
||||
@@ -109,20 +109,21 @@ const acm: ContestRule = {
|
||||
);
|
||||
}
|
||||
for (const pid of tdoc.pids) {
|
||||
const doc = tsddict[pid] || {};
|
||||
let rid;
|
||||
let colAccepted;
|
||||
let colTime;
|
||||
let colTimeStr;
|
||||
if (tsddict[pid]?.accept) {
|
||||
rid = tsddict[pid].rid;
|
||||
if (doc.accept) {
|
||||
rid = doc.rid;
|
||||
colAccepted = _('Accepted');
|
||||
colTime = tsddict[pid].time;
|
||||
colTimeStr = misc.formatSeconds(colTime);
|
||||
colTime = doc.time;
|
||||
colTimeStr = misc.formatSeconds(colTime) + (doc.naccept ? ` (-${doc.naccept})` : '');
|
||||
} else {
|
||||
rid = null;
|
||||
colAccepted = '-';
|
||||
colTime = '-';
|
||||
colTimeStr = '-';
|
||||
colTimeStr = doc.naccept ? `(-${doc.naccept})` : '-';
|
||||
}
|
||||
if (isExport) {
|
||||
row.push({ type: 'string', value: colAccepted });
|
||||
|
||||
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
||||
import tpl from 'vj/utils/tpl';
|
||||
import request from 'vj/utils/request';
|
||||
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
||||
import AutoComplete from '.';
|
||||
import AutoComplete from './index';
|
||||
|
||||
function getText(user) {
|
||||
return user.uname;
|
||||
|
||||
@@ -166,7 +166,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
||||
content = content.split(',');
|
||||
content = content[content.length - 1].trim();
|
||||
}
|
||||
if (this.isFocus && content >= this.options.minChar) {
|
||||
if (this.isFocus && content.length >= this.options.minChar) {
|
||||
if (!this.isOpen) {
|
||||
this.open();
|
||||
this.renderList();
|
||||
@@ -175,9 +175,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
||||
}
|
||||
|
||||
detach() {
|
||||
if (this.detached) {
|
||||
return;
|
||||
}
|
||||
if (this.detached) return;
|
||||
super.detach();
|
||||
this.$dom.off(`focus.${this.eventNS}`);
|
||||
this.$dom.off(`blur.${this.eventNS}`);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.8.11",
|
||||
"version": "4.8.12",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"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) => {
|
||||
$(ev.currentTarget).hide();
|
||||
$('[name="problem-sidebar__categories"]').show();
|
||||
|
||||
Reference in new issue
Block a user