feat: show excluded rounds count in player history accordion (#21)

This commit is contained in:
Samuel Enocsson
2026-05-25 09:34:42 +02:00
parent f4c5e963d2
commit 0beeb98002
10 changed files with 38 additions and 132 deletions
+5 -1
View File
@@ -40,10 +40,12 @@ async function getPlayerDataFromDB(pdgaNumber, { includeMonthlyHistory = true }
let predictedRating = cachedPlayer.predicted_rating;
let stdDev = cachedPlayer.std_dev;
let excludedRoundsCount = cachedPlayer.excluded_rounds_count;
if (!predictedRating || predictedRating === 0) {
predictedRating = await getPredictedRatingFromDB(pdgaNumber);
const updatedPlayer = await getPlayerFromDB(pdgaNumber);
stdDev = updatedPlayer?.std_dev;
excludedRoundsCount = updatedPlayer?.excluded_rounds_count;
}
const rating = cachedPlayer.current_rating;
@@ -65,6 +67,7 @@ async function getPlayerDataFromDB(pdgaNumber, { includeMonthlyHistory = true }
ratingChange,
predictedRating: resolvedPredicted,
stdDev: resolvedStdDev,
excludedRoundsCount: (excludedRoundsCount != null && excludedRoundsCount >= 0) ? excludedRoundsCount : null,
lastMonthRating,
// gap between next predicted update and current rating (null when either is missing)
deltaPredicted: (resolvedPredicted != null && rating != null) ? resolvedPredicted - rating : null,
@@ -145,7 +148,7 @@ async function getPredictedRatingFromDB(pdgaNumber) {
const result = calculatePredictedRating(roundRatings);
await savePredictedRatingToDB(pdgaNumber, result.rating, result.stdDev);
await savePredictedRatingToDB(pdgaNumber, result.rating, result.stdDev, result.excludedRoundsCount);
return result.rating;
}
@@ -229,6 +232,7 @@ async function getAllRatingsFromDB(progressCallback = null) {
ratingChange: errorRatingChange,
predictedRating: null,
stdDev: null,
excludedRoundsCount: null,
lastMonthRating: (errorRating != null && errorRatingChange != null) ? errorRating - errorRatingChange : null,
deltaPredicted: null,
monthlyHistory: [],