Skip to content

Commit

Permalink
feat: surrealdb sort is broken workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
112batuhan committed Dec 8, 2024
1 parent ab5c780 commit a17db32
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/database/leaderboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,24 @@ impl DatabaseClient {
.db
.query(
"
SELECT
beatmap,
count(beatmap) as count
SELECT *
FROM (
(
SELECT beatmaps
FROM influenced_by
WHERE $ranked_only = false OR <-user.ranked_mapper.at(0) = true
SELECT
beatmap,
count(beatmap) as count
FROM (
(
SELECT beatmaps
FROM influenced_by
WHERE $ranked_only = false OR <-user.ranked_mapper.at(0) = true
)
.map(|$val| $val.values())
.flatten()
.flatten()
.map(|$val| {beatmap: $val})
)
.map(|$val| $val.values())
.flatten()
.flatten()
.map(|$val| {beatmap: $val})
GROUP BY beatmap
)
GROUP BY beatmap
ORDER BY count DESC
START $start
LIMIT $limit;
Expand Down

0 comments on commit a17db32

Please sign in to comment.