Skip to content

Commit

Permalink
fix challenge value display, and minimum points (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
reteps authored Jun 29, 2024
1 parent 3db0ca9 commit c9bea6a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions server/leaderboard/calculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ const calculateScores = (sample) => {

for (let i = 0; i < allChallenges.length; i++) {
const challenge = allChallenges[i]
challengeValues.set(challenge.id, getScore(
challenge.points.min,
challenge.points.max,
maxSolveAmount,
solveAmount.get(challenge.id)
))
if (challenge.type === 'ranked') {
challengeValues.set(challenge.id, -1)
} else {
challengeValues.set(challenge.id, getScore(
challenge.points.min,
challenge.points.max,
maxSolveAmount,
solveAmount.get(challenge.id)
))
}
}

const rankedSolvesForLogging = []
Expand All @@ -97,7 +101,7 @@ const calculateScores = (sample) => {
if (rankedMetadata !== undefined) {
// If the challenge is ranked, calculate this on a per-solve basis
value = getRankedScore(
rankedMetadata.min,
100,
rankedMetadata.max,
rankedMetadata.minScore,
rankedMetadata.maxScore,
Expand All @@ -108,7 +112,7 @@ const calculateScores = (sample) => {
challengeId: solvedChallId,
score: solveScore,
value,
min: rankedMetadata.min,
min: 100,
max: rankedMetadata.max,
minScore: rankedMetadata.minScore,
maxScore: rankedMetadata.maxScore
Expand Down

0 comments on commit c9bea6a

Please sign in to comment.