@@ -324,15 +324,15 @@ export const getContestNameLabel = (contestId: string) => {
324324
325325 // AIZU ONLINE JUDGE
326326 if ( aojCoursePrefixes . has ( contestId ) ) {
327- return 'AOJ Courses' ;
327+ return getAojContestLabel ( AOJ_COURSES , contestId ) ;
328328 }
329329
330330 if ( contestId . startsWith ( 'PCK' ) ) {
331- return getAojChallengeLabel ( PCK_TRANSLATIONS , contestId ) ;
331+ return getAojContestLabel ( PCK_TRANSLATIONS , contestId ) ;
332332 }
333333
334334 if ( contestId . startsWith ( 'JAG' ) ) {
335- return getAojChallengeLabel ( JAG_TRANSLATIONS , contestId ) ;
335+ return getAojContestLabel ( JAG_TRANSLATIONS , contestId ) ;
336336 }
337337
338338 return contestId . toUpperCase ( ) ;
@@ -349,6 +349,10 @@ export const getContestNameLabel = (contestId: string) => {
349349 * @returns The formatted contest label (ex: UTPC 2023).
350350 */
351351export function getAtCoderUniversityContestLabel ( contestId : string ) : string {
352+ if ( ! regexForAtCoderUniversity . test ( contestId ) ) {
353+ throw new Error ( `Invalid university contest ID format: ${ contestId } ` ) ;
354+ }
355+
352356 return contestId . replace (
353357 regexForAtCoderUniversity ,
354358 ( _ , contestType , common , contestYear ) =>
@@ -386,7 +390,7 @@ const JAG_TRANSLATIONS = {
386390 Regional : ' 模擬地区 ' ,
387391} ;
388392
389- function getAojChallengeLabel (
393+ export function getAojContestLabel (
390394 translations : Readonly < ContestLabelTranslations > ,
391395 contestId : string ,
392396) : string {
@@ -410,5 +414,7 @@ export const addContestNameToTaskIndex = (contestId: string, taskTableIndex: str
410414} ;
411415
412416function isAojContest ( contestId : string ) : boolean {
413- return contestId . startsWith ( 'PCK' ) || contestId . startsWith ( 'JAG' ) ;
417+ return (
418+ aojCoursePrefixes . has ( contestId ) || contestId . startsWith ( 'PCK' ) || contestId . startsWith ( 'JAG' )
419+ ) ;
414420}
0 commit comments