only update the scores if it's required
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 41s

This commit is contained in:
Lee 2024-07-27 21:05:33 +01:00
parent 8601915f76
commit d3268769e1

View File

@ -202,7 +202,14 @@ public class ScoreSaberPlatform extends Platform {
continue;
}
List<TrackedScore> toUpdate = scores.stream().filter(score -> score.getLeaderboardId().equals(id)).toList();
List<TrackedScore> toUpdate = scores.stream().filter(score -> {
if (!score.getLeaderboardId().equals(id)) { // Check if the leaderboard ID matches
return false;
}
double pp = this.getPp(this.getCurrentCurveVersion(), leaderboard.getStars(), score.getAccuracy());
return pp != score.getPp(); // Check if the pp has changed
}).toList();
for (TrackedScore score : toUpdate) { // Update the scores
double pp = this.getPp(this.getCurrentCurveVersion(), leaderboard.getStars(), score.getAccuracy());
score.setPp(pp);