Remove common.OsuTime, change all occurencies to common.UnixTimestamp

This commit is contained in:
Howl
2016-08-19 17:02:51 +02:00
parent 67ae6ab3b8
commit 817592e736
4 changed files with 20 additions and 90 deletions

View File

@@ -69,7 +69,7 @@ ORDER BY `+sb+` DESC LIMIT `+strconv.Itoa(common.InString(1, c.Query("limit"), 1
s osuapi.GSScore
fullcombo bool
mods int
date common.OsuTime
date common.UnixTimestamp
accuracy float64
)
err := rows.Scan(

View File

@@ -3,7 +3,6 @@ package peppy
import (
"fmt"
"strings"
"time"
"git.zxq.co/ripple/rippleapi/common"
"git.zxq.co/x/getrank"
@@ -55,7 +54,7 @@ func getUserX(c *gin.Context, db *sqlx.DB, orderBy string, limit int) {
for rows.Next() {
var (
curscore osuapi.GUSScore
rawTime string
rawTime common.UnixTimestamp
acc float64
fc bool
mods int
@@ -80,16 +79,7 @@ func getUserX(c *gin.Context, db *sqlx.DB, orderBy string, limit int) {
}
curscore.FullCombo = osuapi.OsuBool(fc)
curscore.Mods = osuapi.Mods(mods)
t, err := time.Parse(common.OsuTimeFormat, rawTime)
// silently ignore ParseErrors. should probably put something in the
// cron to restrict all users who have an "unusual" time format in
// their scores.
if _, ok := err.(*time.ParseError); !ok && err != nil {
c.JSON(200, defaultResponse)
c.Error(err)
return
}
curscore.Date = osuapi.MySQLDate(t)
curscore.Date = osuapi.MySQLDate(rawTime)
curscore.Rank = strings.ToUpper(getrank.GetRank(
osuapi.Mode(m),
curscore.Mods,

View File

@@ -9,23 +9,23 @@ import (
)
type score struct {
ID int `json:"id"`
BeatmapMD5 string `json:"beatmap_md5"`
Score int64 `json:"score"`
MaxCombo int `json:"max_combo"`
FullCombo bool `json:"full_combo"`
Mods int `json:"mods"`
Count300 int `json:"count_300"`
Count100 int `json:"count_100"`
Count50 int `json:"count_50"`
CountGeki int `json:"count_geki"`
CountKatu int `json:"count_katu"`
CountMiss int `json:"count_miss"`
Time common.OsuTime `json:"time"`
PlayMode int `json:"play_mode"`
Accuracy float64 `json:"accuracy"`
PP float32 `json:"pp"`
Completed int `json:"completed"`
ID int `json:"id"`
BeatmapMD5 string `json:"beatmap_md5"`
Score int64 `json:"score"`
MaxCombo int `json:"max_combo"`
FullCombo bool `json:"full_combo"`
Mods int `json:"mods"`
Count300 int `json:"count_300"`
Count100 int `json:"count_100"`
Count50 int `json:"count_50"`
CountGeki int `json:"count_geki"`
CountKatu int `json:"count_katu"`
CountMiss int `json:"count_miss"`
Time common.UnixTimestamp `json:"time"`
PlayMode int `json:"play_mode"`
Accuracy float64 `json:"accuracy"`
PP float32 `json:"pp"`
Completed int `json:"completed"`
}
// beatmapScore is to differentiate from userScore, as beatmapScore contains