track total scores and total ranked scores
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 44s
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m13s

This commit is contained in:
Lee 2024-10-20 19:34:54 +01:00
parent cd2f8c0925
commit bded9969fe
3 changed files with 25 additions and 1 deletions

View File

@ -140,13 +140,21 @@ export class PlayerService {
if (history == undefined) {
history = {}; // Initialize if history is not found
}
const scoreStats = player.scoreStats;
// Set the history data
history.pp = player.pp;
history.countryRank = player.countryRank;
history.rank = player.rank;
history.accuracy = {
averageRankedAccuracy: player.scoreStats.averageRankedAccuracy,
averageRankedAccuracy: scoreStats.averageRankedAccuracy,
};
history.scores = {
totalScores: scoreStats.totalPlayCount,
totalRankedScores: scoreStats.rankedPlayCount,
};
foundPlayer.setStatisticHistory(dateToday, history);
foundPlayer.sortStatisticHistory();
foundPlayer.lastTracked = new Date();

View File

@ -114,6 +114,8 @@ export async function getScoreSaberPlayerFromToken(
scores: {
rankedScores: 0,
unrankedScores: 0,
totalScores: 0,
totalRankedScores: 0,
},
},
...history[todayDate],
@ -152,6 +154,10 @@ export async function getScoreSaberPlayerFromToken(
statisticHistory[dateKey] = {
...statisticHistory[dateKey],
rank: rank,
scores: {
totalScores: token.scoreStats.totalPlayCount,
totalRankedScores: token.scoreStats.rankedPlayCount,
},
};
}
}

View File

@ -27,6 +27,16 @@ export interface PlayerHistory {
* The amount of unranked scores set.
*/
unrankedScores?: number;
/**
* The total amount of ranked scores
*/
totalRankedScores?: number;
/**
* The total amount of scores
*/
totalScores?: number;
};
/**