Skip to content

Commit

Permalink
fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rook committed Jan 5, 2025
1 parent 49de983 commit 9ab56f7
Showing 1 changed file with 67 additions and 67 deletions.
134 changes: 67 additions & 67 deletions project/thscoreboard/replays/migrations/0042_unique_rank_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,85 +14,85 @@ class Migration(migrations.Migration):
sql="""
CREATE OR REPLACE VIEW replays_rank
AS
SELECT
row_number() over () as id,
replay,
score,
shot_id,
difficulty,
route_id,
SELECT
row_number() over () as id,
replay,
score,
shot_id,
difficulty,
route_id,
category,
place
FROM
place
FROM
(
SELECT
replay,
score,
shot_id,
difficulty,
route_id,
category,
created,
SELECT
replay,
score,
shot_id,
difficulty,
route_id,
category,
created,
rank() OVER (
PARTITION BY shot_id,
difficulty,
route_id,
category
ORDER BY
score DESC,
created,
PARTITION BY shot_id,
difficulty,
route_id,
category
ORDER BY
score DESC,
created,
replay
) as place
FROM
) as place
FROM
(
SELECT
replay,
score,
shot_id,
difficulty,
route_id,
category,
created,
user_id
FROM
SELECT
replay,
score,
shot_id,
difficulty,
route_id,
category,
created,
user_id
FROM
(
SELECT
id as replay,
score,
shot_id,
difficulty,
route_id,
category,
created,
user_id,
SELECT
id as replay,
score,
shot_id,
difficulty,
route_id,
category,
created,
user_id,
rank() OVER (
PARTITION BY shot_id,
difficulty,
route_id,
category,
user_id
ORDER BY
score DESC,
created,
PARTITION BY shot_id,
difficulty,
route_id,
category,
user_id
ORDER BY
score DESC,
created,
id
) as per_user_place
FROM
replays_replay
WHERE
) as per_user_place
FROM
replays_replay
WHERE
replay_type = 1 -- FULL_GAME
AND category = 1 -- STANDARD
) AS replays_ranked_per_user
WHERE
) AS replays_ranked_per_user
WHERE
per_user_place = 1
) AS top_replays_per_user
) AS top_replays
WHERE
place <= 3
ORDER BY
shot_id,
difficulty,
route_id,
category,
) AS top_replays
WHERE
place <= 3
ORDER BY
shot_id,
difficulty,
route_id,
category,
place DESC;
""",
reverse_sql="""
Expand Down

0 comments on commit 9ab56f7

Please sign in to comment.