Skip to content

Commit ffabfdb

Browse files
committed
feat: Add math and algo book to contest table (#2785)
1 parent 1eb8d9b commit ffabfdb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/lib/utils/contest_table_provider.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,35 @@ export class TessokuBookProvider extends ContestTableProviderBase {
268268
}
269269
}
270270

271+
export class MathAndAlgorithmProvider extends ContestTableProviderBase {
272+
protected setFilterCondition(): (taskResult: TaskResult) => boolean {
273+
return (taskResult: TaskResult) => {
274+
return classifyContest(taskResult.contest_id) === this.contestType;
275+
};
276+
}
277+
278+
getMetadata(): ContestTableMetaData {
279+
return {
280+
title: 'アルゴリズムと数学',
281+
abbreviationName: 'math-and-algorithm',
282+
};
283+
}
284+
285+
getDisplayConfig(): ContestTableDisplayConfig {
286+
return {
287+
isShownHeader: false,
288+
isShownRoundLabel: false,
289+
roundLabelWidth: '', // No specific width for the round label
290+
tableBodyCellsWidth: 'w-1/2 xs:w-1/3 sm:w-1/4 md:w-1/5 lg:w-1/6 2xl:w-1/7 px-1 py-2',
291+
isShownTaskIndex: true,
292+
};
293+
}
294+
295+
getContestRoundLabel(contestId: string): string {
296+
return '';
297+
}
298+
}
299+
271300
export class EDPCProvider extends ContestTableProviderBase {
272301
protected setFilterCondition(): (taskResult: TaskResult) => boolean {
273302
return (taskResult: TaskResult) => {
@@ -522,6 +551,18 @@ export const prepareContestProviderPresets = () => {
522551
ariaLabel: 'Filter Tessoku Book',
523552
}).addProvider(ContestType.TESSOKU_BOOK, new TessokuBookProvider(ContestType.TESSOKU_BOOK)),
524553

554+
/**
555+
* Single group for Math and Algorithm Book
556+
*/
557+
MathAndAlgorithm: () =>
558+
new ContestTableProviderGroup(`アルゴリズムと数学`, {
559+
buttonLabel: 'アルゴリズムと数学',
560+
ariaLabel: 'Filter Math and Algorithm',
561+
}).addProvider(
562+
ContestType.MATH_AND_ALGORITHM,
563+
new MathAndAlgorithmProvider(ContestType.MATH_AND_ALGORITHM),
564+
),
565+
525566
/**
526567
* DP group (EDPC and TDPC)
527568
*/
@@ -548,6 +589,7 @@ export const contestTableProviderGroups = {
548589
fromAbc212ToAbc318: prepareContestProviderPresets().ABC212ToABC318(),
549590
typical90: prepareContestProviderPresets().Typical90(),
550591
tessokuBook: prepareContestProviderPresets().TessokuBook(),
592+
mathAndAlgorithm: prepareContestProviderPresets().MathAndAlgorithm(),
551593
dps: prepareContestProviderPresets().dps(), // Dynamic Programming (DP) Contests
552594
joiFirstQualRound: prepareContestProviderPresets().JOIFirstQualRound(),
553595
};

0 commit comments

Comments
 (0)