From 52e1fa09ca2f1314f2a9125f5e89e86a336523df Mon Sep 17 00:00:00 2001 From: Howl Date: Wed, 18 May 2016 18:00:22 +0200 Subject: [PATCH] Revert "Normalise floats (don't use Inf in JSON)" This reverts commit 330757ec78c3c9ed342cb8d3baafa87a5726a549. --- app/peppy/user.go | 8 -------- app/v1/user.go | 12 ------------ 2 files changed, 20 deletions(-) diff --git a/app/peppy/user.go b/app/peppy/user.go index b60423f..8c20391 100644 --- a/app/peppy/user.go +++ b/app/peppy/user.go @@ -4,7 +4,6 @@ package peppy import ( "database/sql" "fmt" - "math" "git.zxq.co/ripple/ocl" "github.com/gin-gonic/gin" @@ -50,12 +49,5 @@ func GetUser(c *gin.Context, db *sql.DB) { } user.Level = ocl.GetLevelPrecise(user.TotalScore) - if math.IsInf(user.Accuracy, 0) { - user.Accuracy = 0 - } - if math.IsInf(user.Level, 0) { - user.Level = 0 - } - c.JSON(200, []osuapi.User{user}) } diff --git a/app/v1/user.go b/app/v1/user.go index 8c3dbe0..dc776a7 100644 --- a/app/v1/user.go +++ b/app/v1/user.go @@ -3,7 +3,6 @@ package v1 import ( "database/sql" - "math" "strconv" "strings" "time" @@ -130,17 +129,6 @@ type modeData struct { PP int `json:"pp"` GlobalLeaderboardRank int `json:"global_leaderboard_rank"` } - -func (m modeData) Normalise() modeData { - if math.IsInf(m.Level, 0) { - m.Level = 0 - } - if math.IsInf(m.Accuracy, 0) { - m.Accuracy = 0 - } - return m -} - type userFullResponse struct { common.ResponseBase userData