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:
Bhscerandundefined authored and GitHub committed 2025-07-07 15:31:46 +01:00
1 parent 627ce77d30
commit dc6345c0b3
11 files changed
+30 -18

No files matched your search

+3 -3
View File
@@ -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 = {