This commit is contained in:
parent
bdad804eed
commit
6fda81e81a
@ -157,6 +157,9 @@ public class ScoreService {
|
||||
|
||||
// Sort previous scores by timestamp (newest -> oldest)
|
||||
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
|
||||
if (previousScores.isEmpty()) {
|
||||
@ -190,7 +193,8 @@ public class ScoreService {
|
||||
score.getMaxCombo()
|
||||
);
|
||||
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 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);
|
||||
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,
|
||||
improvedScore ? "Improved " : "",
|
||||
isRanked ? " Ranked" : "",
|
||||
score.getId(),
|
||||
MathUtils.format(score.getAccuracy(), 2),
|
||||
|
Reference in New Issue
Block a user