This commit is contained in:
Howl 2016-05-28 20:31:46 +02:00
parent 571325e98f
commit fb08a80308

View File

@ -25,7 +25,7 @@ func GetUserBest(c *gin.Context, db *sql.DB) {
} else { } else {
sb = "scores.score" sb = "scores.score"
} }
getUserX(c, db, "ORDER BY "+sb+" DESC", common.InString(1, c.Query("limit"), 100, 10)) getUserX(c, db, "AND completed = '3' ORDER BY "+sb+" DESC", common.InString(1, c.Query("limit"), 100, 10))
} }
func getUserX(c *gin.Context, db *sql.DB, orderBy string, limit int) { func getUserX(c *gin.Context, db *sql.DB, orderBy string, limit int) {
@ -59,9 +59,10 @@ func getUserX(c *gin.Context, db *sql.DB, orderBy string, limit int) {
acc float64 acc float64
fc bool fc bool
mods int mods int
bid *int
) )
err := rows.Scan( err := rows.Scan(
&curscore.BeatmapID, &curscore.Score.Score, &curscore.MaxCombo, &bid, &curscore.Score.Score, &curscore.MaxCombo,
&curscore.Count300, &curscore.Count100, &curscore.Count50, &curscore.Count300, &curscore.Count100, &curscore.Count50,
&curscore.CountGeki, &curscore.CountKatu, &curscore.CountMiss, &curscore.CountGeki, &curscore.CountKatu, &curscore.CountMiss,
&fc, &mods, &curscore.UserID, &rawTime, &fc, &mods, &curscore.UserID, &rawTime,
@ -72,6 +73,11 @@ func getUserX(c *gin.Context, db *sql.DB, orderBy string, limit int) {
c.Error(err) c.Error(err)
return return
} }
if bid == nil {
curscore.BeatmapID = 0
} else {
curscore.BeatmapID = *bid
}
curscore.FullCombo = osuapi.OsuBool(fc) curscore.FullCombo = osuapi.OsuBool(fc)
curscore.Mods = osuapi.Mods(mods) curscore.Mods = osuapi.Mods(mods)
t, err := time.Parse(common.OsuTimeFormat, rawTime) t, err := time.Parse(common.OsuTimeFormat, rawTime)