From d87027c85ad11d189c3bb3f91ee547610ef5046e Mon Sep 17 00:00:00 2001 From: Howl Date: Thu, 9 Jun 2016 00:29:00 +0200 Subject: [PATCH] always rank the whole mapset, not just a single diff --- app/v1/beatmap.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/app/v1/beatmap.go b/app/v1/beatmap.go index 1bcceac..22fb9db 100644 --- a/app/v1/beatmap.go +++ b/app/v1/beatmap.go @@ -95,23 +95,20 @@ func BeatmapSetStatusPOST(md common.MethodData) common.CodeMessager { return common.SimpleResponse(400, "ranked status must be 5 < x < -2") } - var ( - whereClause = "beatmapset_id" - param = req.BeatmapsetID - ) + param := req.BeatmapsetID if req.BeatmapID != 0 { - whereClause = "beatmap_id" - param = req.BeatmapID + err := md.DB.QueryRow("SELECT beatmapset_id FROM beatmaps WHERE beatmap_id = ? LIMIT 1", req.BeatmapID).Scan(¶m) + if err != nil { + md.Err(err) + return Err500 + } } md.DB.Exec(`UPDATE beatmaps SET ranked = ?, ranked_status_freezed = ? - WHERE `+whereClause+` = ?`, req.RankedStatus, req.Frozen, param) + WHERE beatmapset_id = ?`, req.RankedStatus, req.Frozen, param) - if whereClause == "beatmapset_id" { - return getSet(md, param) - } - return getBeatmap(md, param) + return getSet(md, param) } // BeatmapGET retrieves a beatmap.