diff options
| -rw-r--r-- | backend/handlers/home.go | 10 |
1 files changed, 10 insertions, 0 deletions
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 ( | |||
| 6 | "log" | 6 | "log" |
| 7 | "net/http" | 7 | "net/http" |
| 8 | "os" | 8 | "os" |
| 9 | "sort" | ||
| 9 | "strings" | 10 | "strings" |
| 10 | 11 | ||
| 11 | "lphub/database" | 12 | "lphub/database" |
| @@ -106,6 +107,15 @@ func RankingsLPHUB(c *gin.Context) { | |||
| 106 | } | 107 | } |
| 107 | } | 108 | } |
| 108 | } | 109 | } |
| 110 | // Sort the overall rankings | ||
| 111 | sort.Slice(response.Overall, func(i, j int) bool { | ||
| 112 | a := response.Overall[i] | ||
| 113 | b := response.Overall[j] | ||
| 114 | if a.TotalScore == b.TotalScore { | ||
| 115 | return a.User.SteamID < b.User.SteamID | ||
| 116 | } | ||
| 117 | return a.TotalScore < b.TotalScore | ||
| 118 | }) | ||
| 109 | 119 | ||
| 110 | placement := 1 | 120 | placement := 1 |
| 111 | ties := 0 | 121 | ties := 0 |