diff options
Diffstat (limited to 'backend/handlers/map.go')
| -rw-r--r-- | backend/handlers/map.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/backend/handlers/map.go b/backend/handlers/map.go index af34dec..c1f68eb 100644 --- a/backend/handlers/map.go +++ b/backend/handlers/map.go | |||
| @@ -188,7 +188,8 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 188 | ) sub | 188 | ) sub |
| 189 | JOIN users AS host ON sub.host_id = host.steam_id | 189 | JOIN users AS host ON sub.host_id = host.steam_id |
| 190 | JOIN users AS partner ON sub.partner_id = partner.steam_id | 190 | JOIN users AS partner ON sub.partner_id = partner.steam_id |
| 191 | WHERE sub.rn = 1` | 191 | WHERE sub.rn = 1 |
| 192 | ORDER BY score_count, score_time` | ||
| 192 | rows, err := database.DB.Query(sql, id) | 193 | rows, err := database.DB.Query(sql, id) |
| 193 | if err != nil { | 194 | if err != nil { |
| 194 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 195 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| @@ -203,7 +204,7 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 203 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 204 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 204 | return | 205 | return |
| 205 | } | 206 | } |
| 206 | if len(records) != 0 && records[len(records)-1].ScoreTime == record.ScoreTime { | 207 | if len(records) != 0 && records[len(records)-1].ScoreCount == record.ScoreCount && records[len(records)-1].ScoreTime == record.ScoreTime { |
| 207 | ties++ | 208 | ties++ |
| 208 | record.Placement = placement - ties | 209 | record.Placement = placement - ties |
| 209 | } else { | 210 | } else { |
| @@ -234,7 +235,8 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 234 | WHERE map_id = $1 | 235 | WHERE map_id = $1 |
| 235 | ) sub | 236 | ) sub |
| 236 | INNER JOIN users ON user_id = users.steam_id | 237 | INNER JOIN users ON user_id = users.steam_id |
| 237 | WHERE rn = 1` | 238 | WHERE rn = 1 |
| 239 | ORDER BY score_count, score_time` | ||
| 238 | rows, err := database.DB.Query(sql, id) | 240 | rows, err := database.DB.Query(sql, id) |
| 239 | if err != nil { | 241 | if err != nil { |
| 240 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 242 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| @@ -249,7 +251,7 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 249 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 251 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 250 | return | 252 | return |
| 251 | } | 253 | } |
| 252 | if len(records) != 0 && records[len(records)-1].ScoreTime == record.ScoreTime { | 254 | if len(records) != 0 && records[len(records)-1].ScoreCount == record.ScoreCount && records[len(records)-1].ScoreTime == record.ScoreTime { |
| 253 | ties++ | 255 | ties++ |
| 254 | record.Placement = placement - ties | 256 | record.Placement = placement - ties |
| 255 | } else { | 257 | } else { |