oopsie
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 1m5s

This commit is contained in:
Lee 2024-08-03 20:24:37 +01:00
parent bdad804eed
commit 6fda81e81a

@ -157,6 +157,9 @@ public class ScoreService {
// Sort previous scores by timestamp (newest -> oldest) // Sort previous scores by timestamp (newest -> oldest)
previousScores.sort(Comparator.comparing(Score::getTimestamp).reversed()); previousScores.sort(Comparator.comparing(Score::getTimestamp).reversed());
// Delete the previous score
scoreRepository.delete(previousScore);
} }
// There are no previous scores, so set it to null to save data // There are no previous scores, so set it to null to save data
if (previousScores.isEmpty()) { if (previousScores.isEmpty()) {
@ -190,7 +193,8 @@ public class ScoreService {
score.getMaxCombo() score.getMaxCombo()
); );
scoreRepository.save(scoreSaberScore); scoreRepository.save(scoreSaberScore);
this.logScore(Platform.Platforms.SCORESABER, scoreSaberScore, user); this.logScore(Platform.Platforms.SCORESABER, scoreSaberScore, user,
previousScore != null && previousScore.getScore() < scoreSaberScore.getScore());
} }
/** /**
@ -200,11 +204,12 @@ public class ScoreService {
* @param score The score to log. * @param score The score to log.
* @param user The user who set the score. * @param user The user who set the score.
*/ */
private void logScore(@NonNull Platform.Platforms platform, @NonNull Score score, @NonNull User user) { private void logScore(@NonNull Platform.Platforms platform, @NonNull Score score, @NonNull User user, boolean improvedScore) {
String platformName = EnumUtils.getEnumName(platform); String platformName = EnumUtils.getEnumName(platform);
boolean isRanked = score.getPp() != 0; boolean isRanked = score.getPp() != 0;
log.info("[{}] Tracked{} Score! id: {}, acc: {}%, {} score id: {},{} leaderboard: {}, player: {}", log.info("[{}] {}Tracked{} Score! id: {}, acc: {}%, {} score id: {},{} leaderboard: {}, player: {}",
platformName, platformName,
improvedScore ? "Improved " : "",
isRanked ? " Ranked" : "", isRanked ? " Ranked" : "",
score.getId(), score.getId(),
MathUtils.format(score.getAccuracy(), 2), MathUtils.format(score.getAccuracy(), 2),