From bc8a9f6fdc1973c6bbf3f2cf5f53ae6c630a38db Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 25 Apr 2024 08:15:19 +0100 Subject: [PATCH] fix --- .../java/cc/fascinated/backend/service/AccountService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/cc/fascinated/backend/service/AccountService.java b/src/main/java/cc/fascinated/backend/service/AccountService.java index 57f7cd4..fc1e067 100644 --- a/src/main/java/cc/fascinated/backend/service/AccountService.java +++ b/src/main/java/cc/fascinated/backend/service/AccountService.java @@ -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 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); } }