api: handle player not setting scores for the day
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 29s

This commit is contained in:
Lee 2024-08-05 04:18:48 +01:00
parent 98223a3293
commit 6f49d81664

@ -153,6 +153,12 @@ public class ScoreSaberPlatform extends Platform {
history.setRank(account.getRank());
history.setCountryRank(account.getCountryRank());
}
// If the player didn't set any scores today, we need to set these values
if (history.getTotalPlayCount() == null || history.getTotalRankedPlayCount() == null || history.getTotalUnrankedPlayCount() == null) {
history.setTotalPlayCount(this.scoreService.getTotalScores(this.getPlatform(), user)); // Get the total scores for the platform
history.setTotalRankedPlayCount(this.scoreService.getTotalRankedScores(this.getPlatform(), user)); // Get the total ranked scores for the platform
history.setTotalUnrankedPlayCount(this.scoreService.getTotalUnrankedScores(this.getPlatform(), user)); // Get the total unranked scores for the platform
}
this.userService.saveUser(user); // Save the user
}
}