-
Notifications
You must be signed in to change notification settings - Fork 0
Fix /overview endpoint
#104
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
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
This PR fixes a bug in the /overview endpoint where the leaderboard was returning empty results for maps in their event version (e.g., Benchmark 2). The fix refactors database queries across three files to use SeaORM's query builder methods instead of raw SQL query construction, and updates the query logic to properly use MIN(time) aggregation with GROUP BY on player IDs.
Key changes:
- Replaced manual SQL
Query::select()construction with SeaORM's fluent query builder API - Added proper
MIN(time)aggregation when grouping byRecordPlayerIdto get best times per player - Removed dependencies on deprecated
global_event_recordsandglobal_recordsentities in favor ofevent_edition_records
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/records_lib/src/ranks.rs | Updated leaderboard query to use MIN(time) for ordering instead of direct time column ordering |
| crates/records_lib/src/leaderboard.rs | Refactored from manual SQL query construction to SeaORM query builder, applying event filters and aggregations |
| crates/game_api/src/http/overview.rs | Refactored rank retrieval query from manual SQL to SeaORM query builder with proper event filtering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Fixes the `leaderboard_into` function from the `records_lib` crate, that was using the wrong source of records to retrieve those of a map that is in its event version, which is thus hidden from the global records (those shown on the website). * Instead of using the global records sources, use the `records` table and join with the `event_edition_records` table if we're in an event context. Closes: #103.
bbf3b78 to
185a595
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR fixes a bug of the
/overviewendpoint, that was returning an empty leaderboard for maps in their event version (e.g. in Benchmark 2).Closes #103.