Skip to content

Commit 0fea626

Browse files
committed
♻️ Refactoring (#1526)
1 parent 0c6031e commit 0fea626

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/lib/utils/contest.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ const regexForAxc = /^(abc|arc|agc)(\d{3})/i;
275275
* - "ttpc2022"
276276
* - "tupc2023"
277277
*/
278-
const regexForAtCoderUniversity = /^(ut|tt|tu)(pc)(\d{4})/;
278+
const regexForAtCoderUniversity = /^(ut|tt|tu)(pc)(\d{4})/i;
279279

280280
export const getContestNameLabel = (contestId: string) => {
281281
// AtCoder
@@ -314,7 +314,7 @@ export const getContestNameLabel = (contestId: string) => {
314314
return 'アルゴリズムと数学';
315315
}
316316

317-
if (atCoderUniversityPrefixes.some((prefix) => contestId.startsWith(prefix))) {
317+
if (regexForAtCoderUniversity.exec(contestId)) {
318318
return getAtCoderUniversityContestLabel(contestId);
319319
}
320320

@@ -356,8 +356,6 @@ export function getAtCoderUniversityContestLabel(contestId: string): string {
356356
);
357357
}
358358

359-
const SPACE = ' ';
360-
361359
/**
362360
* Maps PCK contest type abbreviations to their Japanese translations.
363361
*
@@ -370,8 +368,8 @@ const SPACE = ' ';
370368
*/
371369
const PCK_TRANSLATIONS = {
372370
PCK: 'パソコン甲子園',
373-
Prelim: SPACE + '予選' + SPACE,
374-
Final: SPACE + '本選' + SPACE,
371+
Prelim: ' 予選 ',
372+
Final: ' 本選 ',
375373
};
376374

377375
/**
@@ -384,8 +382,8 @@ const PCK_TRANSLATIONS = {
384382
* }
385383
*/
386384
const JAG_TRANSLATIONS = {
387-
Prelim: SPACE + '模擬国内' + SPACE,
388-
Regional: SPACE + '模擬地区' + SPACE,
385+
Prelim: ' 模擬国内 ',
386+
Regional: ' 模擬地区 ',
389387
};
390388

391389
const aojBaseLabel = 'AOJ - ';

0 commit comments

Comments
 (0)