ignore score if it already exists
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 41s
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 41s
This commit is contained in:
parent
b8f6829f71
commit
0a87877373
@ -157,6 +157,21 @@ export class ScoreService {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
delete scoreToken.playerInfo;
|
||||
|
||||
// Check if the score already exists
|
||||
if (
|
||||
await ScoreSaberScoreModel.exists({
|
||||
playerId: playerId,
|
||||
leaderboardId: leaderboard.id,
|
||||
score: scoreToken.score,
|
||||
})
|
||||
) {
|
||||
console.log(
|
||||
`Score already exists for "${playerName}"(${playerId}), scoreId=${scoreToken.scoreId}, score=${scoreToken.score}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await ScoreSaberScoreModel.create(scoreToken);
|
||||
console.log(
|
||||
`Tracked score and updated scores set statistic for "${playerName}"(${playerId}), scores today: ${scores.rankedScores} ranked, ${scores.unrankedScores} unranked`
|
||||
|
Reference in New Issue
Block a user