Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/guides/how-to-add-contest-table-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ class TessokuBookSectionProvider extends TessokuBookProvider {

### 複合ソース型

| コンテスト | contest_id | 問題数 | セクション | 分割 | 複数コンテスト |
| ------------------ | ---------------------- | ------ | ------------ | ---- | -------------- |
| ABS | `'abs'` | 11問 | A~K | なし | あり(11個) |
| ABC-Like | 計15コンテスト | 2~8問 | A~H | なし | あり(15個) |
| TESSOKU_BOOK | `'tessoku-book'` | 166問 | A(01-77)/B/C | あり | あり |
| MATH_AND_ALGORITHM | `'math-and-algorithm'` | 104問 | 001~104 | なし | あり |
| コンテスト | contest_id | 問題数 | セクション | 分割 | 複数コンテスト |
| ------------------ | ---------------------- | ------ | ------------ | ---- | ----------------------------------------- |
| ABS | `'abs'` | 11問 | A~K | なし | あり(11個) |
| ABC-Like | 計14コンテスト | 2~8問 | A~H | なし | あり(14個)、ABL は ACL と同じ区分で表示 |
| TESSOKU_BOOK | `'tessoku-book'` | 166問 | A(01-77)/B/C | あり | あり |
| MATH_AND_ALGORITHM | `'math-and-algorithm'` | 104問 | 001~104 | なし | あり |

**複合型の参照解決**: `getMergedTasksMap()` が複数コンテスト由来の task_id を自動統合。テストデータは [prisma/contest_task_pairs.ts](../../prisma/contest_task_pairs.ts) を参照。

Expand Down
4 changes: 3 additions & 1 deletion src/lib/utils/contest_table_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@ export class AGC001OnwardsProvider extends ContestTableProviderBase {
export class ABCLikeProvider extends ContestTableProviderBase {
protected setFilterCondition(): (taskResult: TaskResult) => boolean {
return (taskResult: TaskResult) => {
return classifyContest(taskResult.contest_id) === this.contestType;
const contestId = taskResult.contest_id;
// Note: ACL Beginner Contest (ABL) will be shown in ACL provider, so exclude it here.
return classifyContest(contestId) === this.contestType && contestId !== 'abl';
};
}

Expand Down
11 changes: 5 additions & 6 deletions src/test/lib/utils/contest_table_provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1508,9 +1508,9 @@ describe('ContestTableProviderBase and implementations', () => {

test('expects to format contest ID as round label', () => {
const provider = new ABCLikeProvider(ContestType.ABC_LIKE);
const label = provider.getContestRoundLabel('abl');
const label = provider.getContestRoundLabel('jsc2021');

expect(label).toBe('ABL');
expect(label).toBe('JSC2021');
});

test('expects to generate table with multiple contests', () => {
Expand All @@ -1519,7 +1519,6 @@ describe('ContestTableProviderBase and implementations', () => {
const table = provider.generateTable(filtered);

expect(Object.keys(table).length).toBeGreaterThan(0);
expect(table).toHaveProperty('abl');
expect(table).toHaveProperty('jsc2021');
expect(table).toHaveProperty('jsc2025advance-final');
});
Expand Down Expand Up @@ -1557,11 +1556,11 @@ describe('ContestTableProviderBase and implementations', () => {
const provider = new ABCLikeProvider(ContestType.ABC_LIKE);
const filtered = provider.filter(taskResultsForABCLikeProvider);

const ablTasks = filtered.filter((task) => task.contest_id === 'abl');
const zone2021Tasks = filtered.filter((task) => task.contest_id === 'zone2021');
const jsc2021Tasks = filtered.filter((task) => task.contest_id === 'jsc2021');

// ABL: A-F
expect(ablTasks.some((task) => task.task_table_index === 'F')).toBe(true);
// Zone2021: A-F
expect(zone2021Tasks.some((task) => task.task_table_index === 'F')).toBe(true);
// JSC2021: A-H
expect(jsc2021Tasks.some((task) => task.task_table_index === 'H')).toBe(true);
});
Expand Down
10 changes: 5 additions & 5 deletions src/test/lib/utils/test_cases/contest_table_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,10 @@ const [jsc2021_a, jsc2021_h] = createContestTasks('jsc2021', [
{ taskTableIndex: 'H', statusName: TRYING },
]);

const [zone2021_a] = createContestTasks('zone2021', [{ taskTableIndex: 'A', statusName: AC }]);
const [zone2021_a, zone2021_f] = createContestTasks('zone2021', [
{ taskTableIndex: 'A', statusName: AC },
{ taskTableIndex: 'F', statusName: TRYING },
]);

const [sumitrust2019_a] = createContestTasks('sumitrust2019', [
{ taskTableIndex: 'A', statusName: AC },
Expand All @@ -782,10 +785,6 @@ export const taskResultsForABCLikeProvider: TaskResults = [
tenka1_2017_beginner_b,
tenka1_2017_beginner_c,
tenka1_2017_c,
// ABL (6 problems: A-F)
abl_a,
abl_b,
abl_f,
// CADDI2018B (4 problems: A-D)
caddi2018b_a,
caddi2018b_d,
Expand All @@ -808,6 +807,7 @@ export const taskResultsForABCLikeProvider: TaskResults = [
jsc2021_h,
// Zone2021 (6 problems: A-F)
zone2021_a,
zone2021_f,
// Sumitrust2019 (6 problems: A-F)
sumitrust2019_a,
// JSC2025Advance-Final (references ABC422 task_id)
Expand Down
Loading