api: since we have this, might aswell track it, but it won't be be accurate if they ether: don't set a score that day, or only set 1 score in the morning, but it's better than no data for that day
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 30s

This commit is contained in:
Lee 2024-08-05 04:32:06 +01:00
parent 84eb8a4b94
commit ba24eabfaa

View File

@ -5,6 +5,7 @@ import cc.fascinated.exception.impl.BadRequestException;
import cc.fascinated.model.token.ScoreSaberAccountToken;
import cc.fascinated.model.user.ScoreSaberAccount;
import cc.fascinated.model.user.User;
import cc.fascinated.model.user.history.HistoryPoint;
import cc.fascinated.repository.UserRepository;
import lombok.NonNull;
import lombok.extern.log4j.Log4j2;
@ -80,6 +81,11 @@ public class UserService {
ScoreSaberAccountToken accountToken = scoreSaberService.getAccount(user);
user.setScoresaberAccount(ScoreSaberAccount.getFromToken(accountToken)); // Update the ScoreSaber account
user.setUsername(accountToken.getName()); // Update the username
HistoryPoint historyToday = user.getHistory().getTodayHistory();
historyToday.setRank(accountToken.getRank());
historyToday.setCountryRank(accountToken.getCountryRank());
historyToday.setPp(accountToken.getPp());
} catch (Exception ex) {
log.error("Failed to update ScoreSaber account for '{}'", steamId, ex);
}