mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: fix contest with more than 26 problems have wrong alphabetic id (#1008)
Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
1 parent
627ce77d30
commit
dc6345c0b3
11 files changed
+30
-18
No files matched your search
@@ -5,7 +5,7 @@ import { escapeRegExp, pick } from 'lodash';
|
||||
import moment from 'moment-timezone';
|
||||
import { ObjectId } from 'mongodb';
|
||||
import {
|
||||
Counter, diffArray, randomstring, sortFiles, Time, yaml,
|
||||
Counter, diffArray, getAlphabeticId, randomstring, sortFiles, Time, yaml,
|
||||
} from '@hydrooj/utils/lib/utils';
|
||||
import { Context, Service } from '../context';
|
||||
import {
|
||||
@@ -132,7 +132,7 @@ export class ContestDetailBaseHandler extends Handler {
|
||||
},
|
||||
{
|
||||
name: 'problem_detail',
|
||||
displayName: `${String.fromCharCode(65 + this.tdoc.pids.indexOf(pdoc.docId))}. ${pdoc.title}`,
|
||||
displayName: `${getAlphabeticId(this.tdoc.pids.indexOf(pdoc.docId))}. ${pdoc.title}`,
|
||||
args: { query: { tid }, pid: pdoc.docId, prefix: 'contest_detail_problem' },
|
||||
checker: () => 'pdoc' in this,
|
||||
},
|
||||
@@ -791,7 +791,7 @@ export async function apply(ctx: Context) {
|
||||
const teamIds: Record<number, number> = {};
|
||||
for (let i = 1; i <= teams.length; i++) teamIds[teams[i - 1].uid] = i;
|
||||
const time = (t: ObjectId) => Math.floor((t.getTimestamp().getTime() - tdoc.beginAt.getTime()) / Time.second);
|
||||
const pid = (i: number) => String.fromCharCode(65 + i);
|
||||
const pid = (i: number) => getAlphabeticId(i);
|
||||
const escape = (i: string) => i.replace(/[",]/g, '');
|
||||
const unknownSchool = this.translate('Unknown School');
|
||||
const statusMap = {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { sumBy } from 'lodash';
|
||||
import { Filter, ObjectId } from 'mongodb';
|
||||
import { Counter, formatSeconds, Time } from '@hydrooj/utils/lib/utils';
|
||||
import {
|
||||
Counter, formatSeconds, getAlphabeticId, Time,
|
||||
} from '@hydrooj/utils/lib/utils';
|
||||
import {
|
||||
ContestAlreadyAttendedError, ContestNotFoundError,
|
||||
ContestScoreboardHiddenError, ValidationError,
|
||||
@@ -158,7 +160,7 @@ const acm = buildContestRule({
|
||||
} else {
|
||||
columns.push({
|
||||
type: 'problem',
|
||||
value: String.fromCharCode(65 + i - 1),
|
||||
value: getAlphabeticId(i - 1),
|
||||
raw: pid,
|
||||
});
|
||||
}
|
||||
@@ -324,7 +326,7 @@ const oi = buildContestRule({
|
||||
} else {
|
||||
columns.push({
|
||||
type: 'problem',
|
||||
value: String.fromCharCode(65 + i - 1),
|
||||
value: getAlphabeticId(i - 1),
|
||||
raw: tdoc.pids[i - 1],
|
||||
});
|
||||
}
|
||||
@@ -699,7 +701,7 @@ const homework = buildContestRule({
|
||||
} else {
|
||||
columns.push({
|
||||
type: 'problem',
|
||||
value: String.fromCharCode(65 + i - 1),
|
||||
value: getAlphabeticId(i - 1),
|
||||
raw: pid,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user