From cde64e47961823613a69e7d0185f5c36eac2e896 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Sat, 21 Dec 2024 16:32:05 +0300 Subject: fix/rankings: sort overall placements for lphub (#250) --- backend/handlers/home.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'backend/handlers/home.go') diff --git a/backend/handlers/home.go b/backend/handlers/home.go index 714610a..5b4e246 100644 --- a/backend/handlers/home.go +++ b/backend/handlers/home.go @@ -6,6 +6,7 @@ import ( "log" "net/http" "os" + "sort" "strings" "lphub/database" @@ -106,6 +107,15 @@ func RankingsLPHUB(c *gin.Context) { } } } + // Sort the overall rankings + sort.Slice(response.Overall, func(i, j int) bool { + a := response.Overall[i] + b := response.Overall[j] + if a.TotalScore == b.TotalScore { + return a.User.SteamID < b.User.SteamID + } + return a.TotalScore < b.TotalScore + }) placement := 1 ties := 0 -- cgit v1.2.3 From 21980e68693a6941bed352a46212ccb72b8b7d88 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:09:56 +0300 Subject: fix/backend: turret assassin map name typo (#254) --- backend/database/insert/maps.sql | 2 +- backend/handlers/home.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'backend/handlers/home.go') diff --git a/backend/database/insert/maps.sql b/backend/database/insert/maps.sql index f0235fa..e896ba9 100644 --- a/backend/database/insert/maps.sql +++ b/backend/database/insert/maps.sql @@ -96,7 +96,7 @@ INSERT INTO maps(game_id, chapter_id, name, is_disabled, image) VALUES (2,13,'Catapult Block',false,''), (2,13,'Bridge Fling',false,''), (2,13,'Turret Walls',false,''), -(2,13,'Turret Assasin',false,''), +(2,13,'Turret Assassin',false,''), (2,13,'Bridge Testing',false,''), -- 4 (2,14,'Cooperative Funnels',false,''), diff --git a/backend/handlers/home.go b/backend/handlers/home.go index 5b4e246..095b666 100644 --- a/backend/handlers/home.go +++ b/backend/handlers/home.go @@ -327,7 +327,7 @@ func SearchWithQuery(c *gin.Context) { {ID: 80, Game: "Portal 2 - Cooperative", Chapter: "Course 3 - Hard-Light Surfaces", Map: "Catapult Block"}, {ID: 81, Game: "Portal 2 - Cooperative", Chapter: "Course 3 - Hard-Light Surfaces", Map: "Bridge Fling"}, {ID: 82, Game: "Portal 2 - Cooperative", Chapter: "Course 3 - Hard-Light Surfaces", Map: "Turret Walls"}, - {ID: 83, Game: "Portal 2 - Cooperative", Chapter: "Course 3 - Hard-Light Surfaces", Map: "Turret Assasin"}, + {ID: 83, Game: "Portal 2 - Cooperative", Chapter: "Course 3 - Hard-Light Surfaces", Map: "Turret Assassin"}, {ID: 84, Game: "Portal 2 - Cooperative", Chapter: "Course 3 - Hard-Light Surfaces", Map: "Bridge Testing"}, {ID: 85, Game: "Portal 2 - Cooperative", Chapter: "Course 4 - Excursion Funnels", Map: "Cooperative Funnels"}, {ID: 86, Game: "Portal 2 - Cooperative", Chapter: "Course 4 - Excursion Funnels", Map: "Funnel Drill"}, -- cgit v1.2.3