Commit bfa1be2f authored by Howl's avatar Howl
Browse files

Add FixCompletedScores

parent a1efca9a
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ type config struct {
	CalculatePP              bool
	FixScoreDuplicates       bool `description:"might take a VERY long time"`
	CalculateOverallAccuracy bool
	FixCompletedScores       bool `description:"Set to completed = 2 all scores on beatmaps that aren't ranked."`

	LogQueries bool `description:"You don't wanna do this in prod."`
	Workers    int  `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."`
@@ -99,6 +100,18 @@ func main() {
		go op("DELETE FROM password_recovery WHERE t < (NOW() - INTERVAL 10 DAY);")
		color.Green(" ok!")
	}
	if c.FixCompletedScores {
		fmt.Print("Starting fixing completed = 3 scores on not ranked beatmaps...")
		go op(`UPDATE scores
			LEFT JOIN beatmaps ON beatmaps.beatmap_md5 = scores.beatmap_md5
			SET completed = '2'  
			WHERE
				beatmaps.ranked != '1' AND 
				beatmaps.ranked != '2' AND 
				beatmaps.ranked != '3' AND
				beatmaps.ranked != '4';`)
		color.Green(" ok!")
	}
	if c.CacheLevel || c.CacheTotalHits || c.CacheRankedScore {
		fmt.Print("Starting caching of various user stats...")
		wg.Add(1)