Commit f7e59e2c authored by Howl's avatar Howl
Browse files

Take in consideration max 100 scores for PP. Use round() instead of math.Ceil()

parent 00b9f36b
Loading
Loading
Loading
Loading
+11 −1
Changes for calculate_pp.go: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -40,7 +40,10 @@ func opCalculatePP() {
		if users[username] == nil {
			users[username] = &ppUserMode{}
		}
		currentScorePP := math.Ceil(math.Ceil(ppAmt) * math.Pow(0.95, float64(users[username].countScores)))
		if users[username].countScores > 100 {
			continue
		}
		currentScorePP := round(round(ppAmt) * math.Pow(0.95, float64(users[username].countScores)))
		users[username].countScores++
		users[username].ppTotal += int(currentScorePP)
		count++
@@ -61,3 +64,10 @@ func opCalculatePP() {
		color.Green(" ok!")
	}
}

func round(a float64) float64 {
	if a < 0 {
		return math.Ceil(a - 0.5)
	}
	return math.Floor(a + 0.5)
}