Skip to content

Conversation

@KATO-Hiro
Copy link
Collaborator

@KATO-Hiro KATO-Hiro commented Jul 6, 2025

close #1956

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for Educational DP Contest (EDPC) and Typical DP Contest (TDPC) tables, including new provider groups and display options.
    • Introduced multiple contest table provider groups, allowing users to view and switch between grouped contest tables.
    • Added 26 new TDPC problems to the problem set.
  • Enhancements

    • Task tables now render multiple tables per provider group, each with its own configuration and display settings.
    • Table display options now support toggling headers, round labels, and task indices for each provider.
    • Task titles in table cells conditionally show full titles or simplified titles based on display settings.
  • Style

    • Added new fractional width utilities (1/7, 1/8, 1/9, 1/10) for more flexible table layouts.
  • Documentation

    • Improved usage guides for adding new contest table providers.
  • Tests

    • Expanded and refactored test coverage for new provider classes, provider groups, and display configurations.
  • Chores

    • Updated development dependencies to include TypeScript types for jsdom.

Copilot AI review requested due to automatic review settings July 6, 2025 13:30
@coderabbitai
Copy link

coderabbitai bot commented Jul 6, 2025

Walkthrough

The changes introduce support for displaying EDPC and TDPC contests as separate tables without headers or round labels, grouped under a single button. This involves refactoring contest table provider logic, adding new provider classes, updating metadata structures, and extending test coverage to accommodate the new DP contest tables.

Changes

File(s) Change Summary
package.json Added @types/jsdom as a development dependency.
src/lib/components/TaskTables/TaskTable.svelte Refactored to support multiple provider groups; renders multiple tables; adapts to new display config and metadata.
src/lib/components/TaskTables/TaskTableBodyCell.svelte Added isShownTaskIndex prop; updated task title rendering to conditionally show task index.
src/lib/stores/active_contest_type.svelte.ts, src/test/lib/stores/... Updated types from ContestTableProviders to ContestTableProviderGroups throughout store and tests.
src/lib/types/contest_table_provider.ts Modified provider interfaces; added display config; refactored metadata types for separation of concerns.
src/lib/utils/contest_table_provider.ts Exported ABC providers; added EDPC/TDPC providers; introduced provider groups and display config; updated exports.
src/test/lib/utils/contest_table_provider.test.ts Refactored to test new provider classes, display configs, provider groups, and presets.
prisma/tasks.ts Added 26 new TDPC problem entries to the tasks array.
tailwind.config.ts Added new fractional width utilities (1/7, 1/8, 1/9, 1/10) to Tailwind theme.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TaskTableComponent
    participant ProviderGroup
    participant Provider (EDPC/TDPC/ABC)
    participant Store

    User->>TaskTableComponent: Selects contest type group (e.g., "DP")
    TaskTableComponent->>ProviderGroup: Get all providers in group
    loop For each provider (EDPC, TDPC)
        TaskTableComponent->>Provider: Prepare contest table data
        Provider->>TaskTableComponent: Returns table data (no header/round label for DP)
        TaskTableComponent->>TaskTableComponent: Render table per provider
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Display EDPC and TDPC as tables, grouped under a single button (#1956)
Each table should have 4-6 problems per row (#1956)
No round labels or headers in EDPC/TDPC tables (#1956)

Poem

In fields of code where tables grow,
A bunny hops where DP winds blow.
EDPC, TDPC—side by side,
No headers or rounds, just problems to bide.
With buttons and widths, the tables align,
This rabbit approves—your features are fine!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 48934ba and 32d006b.

📒 Files selected for processing (1)
  • src/lib/components/TaskTables/TaskTable.svelte (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/components/TaskTables/TaskTable.svelte
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Educational DP Contest (EDPC) and Typical DP Contest (TDPC) to the contest table, refactors provider registration to use grouped providers, and updates related tests and the Svelte component accordingly.

  • Introduce EDPCProvider and TDPCProvider, register them in ContestProviderBuilder and contestTableProviderGroups
  • Rename contestTableProviderscontestTableProviderGroups and split metadata types into ContestTableMetaData vs. ContestTablesMetaData
  • Update tests and TaskTable.svelte to iterate over provider groups, add display configuration, and introduce new utility classes for dynamic column widths

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/lib/utils/contest_table_provider.ts Added EDPC/TDPC providers, renamed provider exports, new group class and builder
src/lib/types/contest_table_provider.ts Updated metadata and added display config types
src/lib/stores/active_contest_type.svelte.ts Switched to use ContestTableProviderGroups type
src/lib/components/TaskTables/TaskTable.svelte Refactored to render multiple provider tables, added dynamic layout helpers
src/app.css Added custom .w-1/7 and .w-1/8 utility classes
src/test/lib/utils/contest_table_provider.test.ts Extended tests for EDPC/TDPC providers and display config
src/test/lib/stores/active_contest_type.svelte.test.ts Updated tests to use new provider group key type
package.json Added @types/jsdom
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/test/lib/utils/contest_table_provider.test.ts (2)

67-67: Use explicit boolean assertion for clarity.

Replace toBeTruthy() with toBe(true) for more explicit boolean assertions.

-      expect(filtered?.every((task) => task.contest_id.startsWith('abc'))).toBeTruthy();
+      expect(filtered?.every((task) => task.contest_id.startsWith('abc'))).toBe(true);

252-252: Pass a valid contest ID for consistency.

Although the TDPC provider returns an empty string regardless of input, it would be more consistent with other tests to pass a valid contest ID.

-      const label = provider.getContestRoundLabel('');
+      const label = provider.getContestRoundLabel('tdpc');
src/lib/utils/contest_table_provider.ts (1)

374-421: Consider refactoring to a simple module export to address static analysis warning.

The static analysis tool correctly identifies that ContestProviderBuilder contains only static members. While the current implementation is valid, you could refactor it to a simpler module export pattern.

-/**
- * Builder class for easily creating ContestProviderGroups
- */
-export class ContestProviderBuilder {
-  /**
-   * Create predefined groups
-   * Easily create groups with commonly used combinations
-   */
-  static createPresets() {
-    return {
+/**
+ * Create predefined provider groups
+ * Easily create groups with commonly used combinations
+ */
+export const createContestProviderPresets = () => {
+  return {
      /**
       * Single ABC group (latest 20 rounds)
       */
      ABCLatest20Rounds: () =>
        new ContestTableProviderGroup(`ABC Latest 20 Rounds`, {
          buttonLabel: 'ABC 最新 20 回',
          ariaLabel: 'Filter ABC latest 20 rounds',
        }).addProvider(ContestType.ABC, new ABCLatest20RoundsProvider(ContestType.ABC)),

      // ... rest of the presets
-    };
-  }
-}
+  };
+};

Then update the usage:

 export const contestTableProviderGroups = {
-  abcLatest20Rounds: ContestProviderBuilder.createPresets().ABCLatest20Rounds(),
-  abc319Onwards: ContestProviderBuilder.createPresets().ABC319Onwards(),
-  fromAbc212ToAbc318: ContestProviderBuilder.createPresets().ABC212ToABC318(),
-  dps: ContestProviderBuilder.createPresets().dps(),
+  abcLatest20Rounds: createContestProviderPresets().ABCLatest20Rounds(),
+  abc319Onwards: createContestProviderPresets().ABC319Onwards(),
+  fromAbc212ToAbc318: createContestProviderPresets().ABC212ToABC318(),
+  dps: createContestProviderPresets().dps(),
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between c3f025a and 76f96d7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • package.json (1 hunks)
  • src/app.css (1 hunks)
  • src/lib/components/TaskTables/TaskTable.svelte (4 hunks)
  • src/lib/stores/active_contest_type.svelte.ts (6 hunks)
  • src/lib/types/contest_table_provider.ts (2 hunks)
  • src/lib/utils/contest_table_provider.ts (8 hunks)
  • src/test/lib/stores/active_contest_type.svelte.test.ts (2 hunks)
  • src/test/lib/utils/contest_table_provider.test.ts (8 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
src/test/lib/stores/active_contest_type.svelte.test.ts (2)
src/lib/stores/active_contest_type.svelte.ts (1)
  • ActiveContestTypeStore (15-67)
src/lib/utils/contest_table_provider.ts (1)
  • ContestTableProviderGroups (430-430)
src/lib/stores/active_contest_type.svelte.ts (2)
src/lib/stores/local_storage_helper.svelte.ts (1)
  • useLocalStorage (5-7)
src/lib/utils/contest_table_provider.ts (1)
  • ContestTableProviderGroups (430-430)
src/test/lib/utils/contest_table_provider.test.ts (1)
src/lib/utils/contest_table_provider.ts (7)
  • ABCLatest20RoundsProvider (107-140)
  • ABC319OnwardsProvider (144-167)
  • ABC212ToABC318Provider (174-197)
  • EDPCProvider (210-238)
  • TDPCProvider (240-268)
  • ContestTableProviderGroup (275-369)
  • ContestProviderBuilder (374-421)
src/lib/utils/contest_table_provider.ts (3)
src/lib/types/contest_table_provider.ts (3)
  • ContestTableDisplayConfig (129-132)
  • ContestTableMetaData (105-108)
  • ContestTablesMetaData (117-120)
src/lib/types/task.ts (1)
  • TaskResult (62-70)
src/lib/utils/contest.ts (1)
  • classifyContest (5-93)
🪛 Biome (1.9.4)
src/lib/utils/contest_table_provider.ts

[error] 375-424: Avoid classes that contain only static members.

Prefer using simple functions instead of classes with only static members.

(lint/complexity/noStaticOnlyClass)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: preview
🔇 Additional comments (14)
package.json (1)

43-43: LGTM: Good addition of TypeScript types for jsdom.

Adding @types/jsdom provides proper TypeScript support for the existing jsdom dependency, which will improve type safety in tests and DOM manipulation utilities.

src/app.css (1)

15-22: LGTM: Well-implemented custom width utilities.

The new .w-1/7 and .w-1/8 utility classes are correctly implemented with proper slash escaping and accurate percentage calculations. The use of @layer utilities follows Tailwind CSS best practices.

src/test/lib/stores/active_contest_type.svelte.test.ts (2)

3-3: LGTM: Correct type import update.

The import has been properly updated from ContestTableProviders to ContestTableProviderGroups to align with the refactoring to grouped providers.


46-96: Test values correspond to valid provider group keys

All hardcoded values used in the tests—'abcLatest20Rounds', 'abc319Onwards', and 'fromAbc212ToAbc318'—are present as keys in contestTableProviderGroups (src/lib/utils/contest_table_provider.ts). No changes required.

src/lib/types/contest_table_provider.ts (3)

51-54: LGTM: Good addition of display configuration method.

The new getDisplayConfig() method provides a clean way to control table display behavior, promoting better separation of concerns between data and presentation logic.


105-108: LGTM: Improved metadata structure.

The refactoring of ContestTableMetaData to focus on core metadata (title, abbreviationName) while moving UI-specific properties to ContestTablesMetaData is a good design decision that improves separation of concerns.


110-132: LGTM: Well-designed new types for UI configuration.

The new ContestTablesMetaData and ContestTableDisplayConfig types provide clear, focused interfaces for UI configuration. The comprehensive JSDoc documentation makes the purpose and usage clear.

src/lib/stores/active_contest_type.svelte.ts (3)

2-2: LGTM: Correct type import update.

The import has been properly updated to use ContestTableProviderGroups instead of ContestTableProviders, aligning with the refactoring to grouped providers.


27-67: LGTM: Consistent type updates throughout the class.

All method signatures have been properly updated to use ContestTableProviderGroups instead of ContestTableProviders. The type safety and functionality are maintained while adapting to the new grouped provider architecture.


16-19: Default key ‘abcLatest20Rounds’ is valid in ContestTableProviderGroups

The default value abcLatest20Rounds is already defined in src/lib/utils/contest_table_provider.ts:

  • contestTableProviderGroups includes
    abcLatest20Rounds: ContestProviderBuilder.createPresets().ABCLatest20Rounds()

No further changes needed.

src/test/lib/utils/contest_table_provider.test.ts (1)

6-14: Excellent test coverage for new provider functionality!

The test suite has been comprehensively extended to cover:

  • New EDPC and TDPC providers with proper metadata and display configuration tests
  • ContestTableProviderGroup functionality including group creation, provider management, and statistics
  • ContestProviderBuilder presets with verification of independent instances

The tests follow consistent patterns and provide good coverage of the new features.

Also applies to: 208-451

src/lib/utils/contest_table_provider.ts (2)

14-29: Excellent documentation for extensibility!

The step-by-step guide for adding new contest table providers is clear and helpful. This will make it easy for future contributors to extend the system.


210-268: Well-implemented DP contest providers!

The EDPC and TDPC providers are correctly implemented with:

  • Appropriate filtering for their specific contest IDs
  • Display configuration that hides headers and round labels (suitable for single-contest providers)
  • Clear metadata with both English and Japanese titles

The empty contest round labels are appropriate since these providers represent single contests rather than contest series.

src/lib/components/TaskTables/TaskTable.svelte (1)

47-93: Excellent refactoring to support provider groups!

The component has been successfully refactored to:

  • Handle multiple providers within a group
  • Respect display configuration for headers and round labels
  • Render separate tables for each provider with appropriate titles
  • Maintain reactive updates through proper use of Svelte 5's $derived rune

The implementation is clean and maintains backward compatibility while adding the new functionality.

Also applies to: 185-256

Copy link
Collaborator Author

@KATO-Hiro KATO-Hiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KATO-Hiro KATO-Hiro merged commit dca85ba into staging Jul 9, 2025
3 checks passed
@KATO-Hiro KATO-Hiro deleted the #1956 branch July 9, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] EDPC・TDPCをテーブル形式で表示できるようにしましょう

2 participants