fix
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m21s

This commit is contained in:
Lee 2024-04-25 08:15:19 +01:00
parent ae19233ddf
commit bc8a9f6fdc

@ -10,6 +10,7 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
@ -70,7 +71,6 @@ public class AccountService {
Optional<Account> optionalAccount = accountRepository.findById(id);
if (optionalAccount.isEmpty()) {
log.info("Account '{}' not found in the database. Fetching from ScoreSaber API.", id);
return updateAccount(Account.fromToken(scoreSaberService.getAccount(id)));
}
log.info("Account '{}' found in the database.", id);
@ -95,6 +95,7 @@ public class AccountService {
// Update the account with the new token.
account = Account.fromToken(accountToken);
accountRepository.save(account);
// Fetch the scores for the account.
scoreSaberService.updateScores(account);
@ -102,8 +103,6 @@ public class AccountService {
// Set the raw pp per +1 global pp
double rawPerGlobalPP = ScoreSaberLeaderboard.INSTANCE.getRawPerGlobalPP(scoreRepository.getRankedScoresForAccount(id), 1);
account.setRawPerGlobalPerformancePoints(rawPerGlobalPP);
// Save the account to the database.
return accountRepository.save(account);
}
}