Commit eab87cf3 authored by Howl's avatar Howl
Browse files

.HIDE. .FIX. Fixes to PP calculation

parent 1a0a2d86
Loading
Loading
Loading
Loading
+6 −2
Changes for calculate_pp.go: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ func opCalculatePP() {
		}
		var (
			username string
			ppAmt    int
			ppAmt    float64
			playMode int
		)
		err := rows.Scan(&username, &ppAmt, &playMode)
@@ -40,13 +40,17 @@ func opCalculatePP() {
		if users[username] == nil {
			users[username] = &ppUserMode{}
		}
		currentScorePP := math.Ceil(math.Ceil(float64(ppAmt)) * math.Pow(0.95, float64(users[username].countScores)))
		currentScorePP := math.Ceil(math.Ceil(ppAmt) * math.Pow(0.95, float64(users[username].countScores)))
		users[username].countScores++
		users[username].ppTotal += int(currentScorePP)
		count++
	}
	rows.Close()

	for username, ppUM := range users {
		op("UPDATE users_stats SET pp_std = ? WHERE username = ?", ppUM.ppTotal, username)
	}

	color.Green("> CalculatePP: done!")

	wg.Done()