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:
parent
934271c0b0
commit
d866615034
@ -185,8 +185,10 @@ func checkScoreDelta(scoreRows *[]Row, deltaRows *[]Row) *[]Row {
|
|||||||
|
|
||||||
var avgStr string
|
var avgStr string
|
||||||
if u.Times > 0 {
|
if u.Times > 0 {
|
||||||
var avg float64 = float64(u.LastScore - u.ScoreOffset) / float64(u.Times)
|
avg := float64(score - u.ScoreOffset) / float64(u.Times)
|
||||||
avgStr = strconv.FormatFloat(avg, 'f', -1, 32)
|
avgStr = fmt.Sprintf("%.2f", avg)
|
||||||
|
avgStr = strings.TrimRight(avgStr, "0")
|
||||||
|
avgStr = strings.TrimRight(avgStr, ".")
|
||||||
} else {
|
} else {
|
||||||
avgStr = "-"
|
avgStr = "-"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user