From cab63a94ace043b2ae40d337d1f0bf66cbdcbfe5 Mon Sep 17 00:00:00 2001 From: Howl Date: Mon, 15 Aug 2016 21:37:24 +0200 Subject: [PATCH] Make rank actually contain rank --- app/peppy/score.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/peppy/score.go b/app/peppy/score.go index e618025..8aff443 100644 --- a/app/peppy/score.go +++ b/app/peppy/score.go @@ -3,12 +3,14 @@ package peppy import ( "database/sql" "strconv" + "strings" "git.zxq.co/ripple/rippleapi/common" + "git.zxq.co/x/getrank" "github.com/gin-gonic/gin" "github.com/jmoiron/sqlx" - "github.com/thehowl/go-osuapi" + "gopkg.in/thehowl/go-osuapi.v1" ) // GetScores retrieve information about the top 100 scores of a specified beatmap. @@ -36,7 +38,8 @@ func GetScores(c *gin.Context, db *sqlx.DB) { SELECT scores.id, scores.score, users.username, scores.300_count, scores.100_count, scores.50_count, scores.misses_count, scores.gekis_count, scores.katus_count, - scores.max_combo, scores.full_combo, scores.mods, users.id, scores.time, scores.pp + scores.max_combo, scores.full_combo, scores.mods, users.id, scores.time, scores.pp, + scores.accuracy FROM scores INNER JOIN users ON users.id = scores.userid WHERE scores.completed = '3' @@ -57,11 +60,13 @@ ORDER BY `+sb+` DESC LIMIT `+strconv.Itoa(common.InString(1, c.Query("limit"), 1 fullcombo bool mods int date common.OsuTime + accuracy float64 ) err := rows.Scan( &s.ScoreID, &s.Score.Score, &s.Username, &s.Count300, &s.Count100, &s.Count50, &s.CountMiss, &s.CountGeki, &s.CountKatu, &s.MaxCombo, &fullcombo, &mods, &s.UserID, &date, &s.PP, + &accuracy, ) if err != nil { if err != sql.ErrNoRows { @@ -72,6 +77,8 @@ ORDER BY `+sb+` DESC LIMIT `+strconv.Itoa(common.InString(1, c.Query("limit"), 1 s.FullCombo = osuapi.OsuBool(fullcombo) s.Mods = osuapi.Mods(mods) s.Date = osuapi.MySQLDate(date) + s.Rank = strings.ToUpper(getrank.GetRank(osuapi.Mode(genmodei(c.Query("m"))), s.Mods, + accuracy, s.Count300, s.Count100, s.Count50, s.CountMiss)) results = append(results, s) } c.JSON(200, results)