-
-
Notifications
You must be signed in to change notification settings - Fork 10
✨ Add JOI first qual round to contest table (#2321) #2322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
""" WalkthroughThe changes introduce a new contest table provider for JOI first qualification rounds, update display configurations to allow dynamic round label widths, and add numerous JOI contest problems to the tasks dataset. The provider, display logic, and types are updated, and comprehensive tests are added to verify the new functionality and configuration. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TableComponent
participant JOIFirstQualRoundProvider
participant DataStore
User->>TableComponent: Selects JOI First Qual Round Table
TableComponent->>JOIFirstQualRoundProvider: Request contest table data
JOIFirstQualRoundProvider->>DataStore: Fetch tasks
DataStore-->>JOIFirstQualRoundProvider: Return all tasks
JOIFirstQualRoundProvider->>JOIFirstQualRoundProvider: Filter tasks by JOI first qual round regex
JOIFirstQualRoundProvider-->>TableComponent: Return filtered tasks and display config
TableComponent->>TableComponent: Render table with dynamic round label width
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support and seed data for the JOI First Qualifying Round while introducing a dynamic roundLabelWidth display configuration and updating the task table component to use it.
- Introduces
JOIFirstQualRoundProvider(filtering, metadata, display config) and corresponding tests. - Extends
ContestTableDisplayConfigwithroundLabelWidthand updatesTaskTable.svelteto apply it. - Populates
prisma/tasks.tswith JOI tasks for 2020–2025.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/lib/utils/contest_table_provider.test.ts | Added tests for the new JOI First Qual Round provider |
| src/lib/utils/contest_table_provider.ts | Implemented JOIFirstQualRoundProvider and roundLabelWidth |
| src/lib/types/contest_table_provider.ts | Added roundLabelWidth to ContestTableDisplayConfig |
| src/lib/components/TaskTables/TaskTable.svelte | Updated classes to use the new roundLabelWidth setting |
| prisma/tasks.ts | Seeded additional JOI tasks across multiple contest years |
Comments suppressed due to low confidence (3)
src/lib/utils/contest_table_provider.ts:101
- [nitpick] Comment refers to "task index column" but this setting controls the round label width; update the wording for clarity.
roundLabelWidth: 'xl:w-16', // Default width for task index column
src/lib/components/TaskTables/TaskTable.svelte:206
- Svelte does not support mustache interpolation inside a quoted class string. Use a bound attribute or string concatenation, e.g., class={"w-full " + contestTable.displayConfig.roundLabelWidth + " px-2 text-center"}.
class="w-full {contestTable.displayConfig.roundLabelWidth} px-2 text-center"
src/lib/components/TaskTables/TaskTable.svelte:236
- Interpolation inside the class attribute won’t work as written. Switch to a bound class attribute or concatenate the string dynamically.
.roundLabelWidth} truncate px-2 py-2 text-center bg-gray-50 dark:bg-gray-800"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/lib/utils/contest_table_provider.ts (1)
276-276: Consider anchoring the regex pattern for stricter validation.The regex pattern correctly matches JOI first qualification round contest IDs, but could be made more strict by anchoring the end.
-const regexForJoiFirstQualRound = /^(joi)(\d{4})(yo1)(a|b|c)/i; +const regexForJoiFirstQualRound = /^(joi)(\d{4})(yo1)(a|b|c)$/i;This prevents potential partial matches while maintaining the same functionality.
📜 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
📒 Files selected for processing (5)
prisma/tasks.ts(4 hunks)src/lib/components/TaskTables/TaskTable.svelte(3 hunks)src/lib/types/contest_table_provider.ts(1 hunks)src/lib/utils/contest_table_provider.ts(6 hunks)src/test/lib/utils/contest_table_provider.test.ts(9 hunks)
⏰ 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
🔇 Additional comments (10)
src/lib/types/contest_table_provider.ts (1)
128-128: LGTM! Clean interface extension with proper documentation.The addition of
roundLabelWidthproperty is well-documented and appropriately typed. The JSDoc example clearly demonstrates the expected Tailwind CSS class format.Also applies to: 134-134
src/lib/components/TaskTables/TaskTable.svelte (2)
109-112: LGTM! Improved responsive design for table cells.The conditional logic enhances responsive behavior by using more granular breakpoints (md, lg) when there are 5+ columns, which should provide better layout optimization across different screen sizes.
205-210: LGTM! Consistent implementation of dynamic round label width.The replacement of hardcoded
xl:w-16classes with dynamiccontestTable.displayConfig.roundLabelWidthbinding is implemented consistently across both header and body cells. This properly enables different contest providers to specify their own round label column widths.Also applies to: 235-236
prisma/tasks.ts (1)
4823-5128: LGTM! JOI contest problems added correctly.The new JOI first qualification round problems are properly formatted and follow the established data structure patterns. All entries have correct ID formatting, proper title structure, and are organized by contest and problem index.
src/test/lib/utils/contest_table_provider.test.ts (2)
27-48: Mock implementations updated correctly for JOI contests.The mock functions properly classify JOI contests and format their labels according to the expected pattern.
281-396: Comprehensive test coverage for JOIFirstQualRoundProvider.The test suite thoroughly covers all aspects of the new JOI provider including filtering, metadata, display configuration, label formatting, and edge case handling. The tests are well-structured and follow established patterns.
src/lib/utils/contest_table_provider.ts (4)
101-101: LGTM: Good addition of default round label width.The default
roundLabelWidth: 'xl:w-16'provides a sensible baseline for the dynamic width configuration while maintaining backward compatibility.
234-234: LGTM: Consistent empty width configuration for task-index-focused providers.Setting
roundLabelWidth: ''for EDPC and TDPC providers is appropriate since these providers show task indexes instead of round labels, ensuring they don't inherit the default width.Also applies to: 266-266
278-309: LGTM: Well-implemented JOI provider following established patterns.The
JOIFirstQualRoundProviderimplementation is consistent with existing providers:
- Proper contest type validation before regex filtering
- Appropriate metadata with Japanese titles
- Wider round label width (
xl:w-28) suitable for longer JOI contest names- Clean round label formatting by removing the prefix
The implementation follows the documented step-by-step pattern for adding new providers.
457-461: LGTM: Proper provider registration and export.The new JOI provider is correctly:
- Registered in
prepareContestProviderPresets()with appropriate labels and aria attributes- Exported in
contestTableProviderGroupsusing the expected key naming convention- Associated with the correct
ContestType.JOIAlso applies to: 470-470
KATO-Hiro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
close #2321
Summary by CodeRabbit
New Features
Improvements
Tests