diff options
| author | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2024-09-16 18:19:19 +0200 |
|---|---|---|
| committer | Wolfboy248 <georgejvindkarlsen@gmail.com> | 2024-09-16 18:19:19 +0200 |
| commit | 4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21 (patch) | |
| tree | 2162b11b64083aca965724f89e658164eec28f25 /backend | |
| parent | refactor: rankings page (diff) | |
| parent | refactor: proper game/map ordering (diff) | |
| download | lphub-4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21.tar.gz lphub-4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21.tar.bz2 lphub-4c036c9a8bb39abe3bc10a30fdfcf53fb9613e21.zip | |
Rankings page
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/handlers/map.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/handlers/map.go b/backend/handlers/map.go index 56c3455..33910fe 100644 --- a/backend/handlers/map.go +++ b/backend/handlers/map.go | |||
| @@ -328,7 +328,7 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 328 | // @Failure 400 {object} models.Response | 328 | // @Failure 400 {object} models.Response |
| 329 | // @Router /games [get] | 329 | // @Router /games [get] |
| 330 | func FetchGames(c *gin.Context) { | 330 | func FetchGames(c *gin.Context) { |
| 331 | rows, err := database.DB.Query(`SELECT id, name, is_coop, image FROM games`) | 331 | rows, err := database.DB.Query(`SELECT id, name, is_coop, image FROM games ORDER BY id;`) |
| 332 | if err != nil { | 332 | if err != nil { |
| 333 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 333 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 334 | return | 334 | return |
| @@ -340,7 +340,7 @@ func FetchGames(c *gin.Context) { | |||
| 340 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 340 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 341 | return | 341 | return |
| 342 | } | 342 | } |
| 343 | categoryPortalRows, err := database.DB.Query(`SELECT c.id, c.name FROM game_categories gc JOIN categories c ON gc.category_id = c.id WHERE gc.game_id = $1`, game.ID) | 343 | categoryPortalRows, err := database.DB.Query(`SELECT c.id, c.name FROM game_categories gc JOIN categories c ON gc.category_id = c.id WHERE gc.game_id = $1 ORDER BY c.id;`, game.ID) |
| 344 | if err != nil { | 344 | if err != nil { |
| 345 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 345 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 346 | return | 346 | return |
| @@ -403,7 +403,7 @@ func FetchChapters(c *gin.Context) { | |||
| 403 | return | 403 | return |
| 404 | } | 404 | } |
| 405 | var response ChaptersResponse | 405 | var response ChaptersResponse |
| 406 | rows, err := database.DB.Query(`SELECT c.id, c.name, g.name, c.is_disabled, c.image FROM chapters c INNER JOIN games g ON c.game_id = g.id WHERE game_id = $1`, gameID) | 406 | rows, err := database.DB.Query(`SELECT c.id, c.name, g.name, c.is_disabled, c.image FROM chapters c INNER JOIN games g ON c.game_id = g.id WHERE game_id = $1 ORDER BY c.id;`, gameID) |
| 407 | if err != nil { | 407 | if err != nil { |
| 408 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 408 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 409 | return | 409 | return |
| @@ -448,7 +448,7 @@ func FetchMaps(c *gin.Context) { | |||
| 448 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 448 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 449 | return | 449 | return |
| 450 | } | 450 | } |
| 451 | categoryPortalRows, err := database.DB.Query(`SELECT c.id, c.name FROM game_categories gc JOIN categories c ON gc.category_id = c.id WHERE gc.game_id = $1`, gameID) | 451 | categoryPortalRows, err := database.DB.Query(`SELECT c.id, c.name FROM game_categories gc JOIN categories c ON gc.category_id = c.id WHERE gc.game_id = $1 ORDER BY c.id;`, gameID) |
| 452 | if err != nil { | 452 | if err != nil { |
| 453 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) | 453 | c.JSON(http.StatusOK, models.ErrorResponse(err.Error())) |
| 454 | return | 454 | return |