Revert "Normalise floats (don't use Inf in JSON)"

This reverts commit 330757ec78.
This commit is contained in:
Howl 2016-05-18 18:00:22 +02:00
parent ef14f027b7
commit 52e1fa09ca
2 changed files with 0 additions and 20 deletions

View File

@ -4,7 +4,6 @@ package peppy
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"math"
"git.zxq.co/ripple/ocl" "git.zxq.co/ripple/ocl"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -50,12 +49,5 @@ func GetUser(c *gin.Context, db *sql.DB) {
} }
user.Level = ocl.GetLevelPrecise(user.TotalScore) 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}) c.JSON(200, []osuapi.User{user})
} }

View File

@ -3,7 +3,6 @@ package v1
import ( import (
"database/sql" "database/sql"
"math"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -130,17 +129,6 @@ type modeData struct {
PP int `json:"pp"` PP int `json:"pp"`
GlobalLeaderboardRank int `json:"global_leaderboard_rank"` 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 { type userFullResponse struct {
common.ResponseBase common.ResponseBase
userData userData