aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-12-22 10:57:40 +0300
committerGitHub <noreply@github.com>2024-12-22 10:57:40 +0300
commit75c0117ba7c58e6fbcc17648276e8d6951e7ad0d (patch)
tree9f07c5d555dcb931af4e39ac5c09d641fd0e4b61
parentfix/rankings: sort overall placements for lphub (#250) (diff)
downloadlphub-75c0117ba7c58e6fbcc17648276e8d6951e7ad0d.tar.gz
lphub-75c0117ba7c58e6fbcc17648276e8d6951e7ad0d.tar.bz2
lphub-75c0117ba7c58e6fbcc17648276e8d6951e7ad0d.zip
fix/profile: overall completion count wrong (#252)
Diffstat (limited to '')
-rw-r--r--backend/handlers/user.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/backend/handlers/user.go b/backend/handlers/user.go
index 53f0d06..ea31065 100644
--- a/backend/handlers/user.go
+++ b/backend/handlers/user.go
@@ -4,6 +4,7 @@ import (
4 "net/http" 4 "net/http"
5 "os" 5 "os"
6 "regexp" 6 "regexp"
7 "sort"
7 "time" 8 "time"
8 9
9 "lphub/database" 10 "lphub/database"
@@ -183,6 +184,15 @@ func Profile(c *gin.Context) {
183 } 184 }
184 } 185 }
185 } 186 }
187 // Sort the overall rankings
188 sort.Slice(rankingsList.Overall, func(i, j int) bool {
189 a := rankingsList.Overall[i]
190 b := rankingsList.Overall[j]
191 if a.TotalScore == b.TotalScore {
192 return a.User.SteamID < b.User.SteamID
193 }
194 return a.TotalScore < b.TotalScore
195 })
186 196
187 placement := 1 197 placement := 1
188 ties := 0 198 ties := 0
@@ -507,6 +517,15 @@ func FetchUser(c *gin.Context) {
507 } 517 }
508 } 518 }
509 } 519 }
520 // Sort the overall rankings
521 sort.Slice(rankingsList.Overall, func(i, j int) bool {
522 a := rankingsList.Overall[i]
523 b := rankingsList.Overall[j]
524 if a.TotalScore == b.TotalScore {
525 return a.User.SteamID < b.User.SteamID
526 }
527 return a.TotalScore < b.TotalScore
528 })
510 529
511 placement := 1 530 placement := 1
512 ties := 0 531 ties := 0