1
0
mirror of https://github.com/thebaer/tildes.git synced 2018-07-20 07:15:21 +00:00

Trim averages to at most 2 decimal places

This commit is contained in:
Matt Baer 2015-01-31 23:42:04 -05:00
parent 934271c0b0
commit d866615034

View File

@ -185,8 +185,10 @@ func checkScoreDelta(scoreRows *[]Row, deltaRows *[]Row) *[]Row {
var avgStr string
if u.Times > 0 {
var avg float64 = float64(u.LastScore - u.ScoreOffset) / float64(u.Times)
avgStr = strconv.FormatFloat(avg, 'f', -1, 32)
avg := float64(score - u.ScoreOffset) / float64(u.Times)
avgStr = fmt.Sprintf("%.2f", avg)
avgStr = strings.TrimRight(avgStr, "0")
avgStr = strings.TrimRight(avgStr, ".")
} else {
avgStr = "-"
}