diff --git a/server/handler/get_popular_game_infos.go b/server/handler/get_popular_game_infos.go index ea57daa..0748626 100644 --- a/server/handler/get_popular_game_infos.go +++ b/server/handler/get_popular_game_infos.go @@ -20,7 +20,7 @@ type GetPopularGamesResponse struct { // @Tags popular // @Accept json // @Produce json -// @Param type path string true "Type(igdb-most-visited, igdb-most-wanted-to-play, igdb-most-playing, igdb-most-played, steam-top, v, steam-best-of-the-year, steam-most-played)" +// @Param type path string true "Type(igdb-most-visited, igdb-most-wanted-to-play, igdb-most-playing, igdb-most-played, steam-top, steam-week-top, steam-best-of-the-year, steam-most-played)" // @Success 200 {object} GetPopularGamesResponse // @Failure 400 {object} GetPopularGamesResponse // @Failure 500 {object} GetPopularGamesResponse @@ -68,7 +68,9 @@ func GetPopularGameInfosHandler(c *gin.Context) { Message: err.Error(), }) } - infos = infos[:10] + if len(infos) > 10 { + infos = infos[:10] + } } else { offset := 0 for len(infos) < 10 { @@ -97,7 +99,9 @@ func GetPopularGameInfosHandler(c *gin.Context) { } infos = append(infos, newInfos...) } - infos = infos[:10] + if len(infos) > 10 { + infos = infos[:10] + } } c.JSON(http.StatusOK, GetPopularGamesResponse{ Status: "ok",