diff --git a/.gitignore b/.gitignore index 13b969315..63e78fe94 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ node_modules .env db*.sqlite3* +dump /cypress/videos /cypress/screenshots diff --git a/app/routes/plus/voting/results.tsx b/app/routes/plus/voting/results.tsx index 973ad72e8..902c07394 100644 --- a/app/routes/plus/voting/results.tsx +++ b/app/routes/plus/voting/results.tsx @@ -49,13 +49,15 @@ export const loader: LoaderFunction = async ({ request }) => { return json({ results, - ownScores: ownScores?.map(maybeHideScore), + ownScores: ownScores?.map(scoreForDisplaying), }); }; export default function PlusVotingResultsPage() { const data = useLoaderData(); + console.log({ data }); + const { month, year } = lastCompletedVoting(new Date()); return ( @@ -75,7 +77,7 @@ export default function PlusVotingResultsPage() { )}{" "} the +{result.tier} voting {result.score - ? `, your score was ${result.score} (at least 0.5 required to pass)` + ? `, your score was ${result.score}% (at least 50% required to pass)` : ""} ))} @@ -134,14 +136,20 @@ function Results({ ); } -function maybeHideScore( +function databaseAvgToPercentage(score: number) { + const scoreNormalized = score + 1; + + return roundToTwoDecimalPlaces((scoreNormalized / 2) * 100); +} + +function scoreForDisplaying( score: Unpacked> ) { const showScore = score.wasSuggested && !score.passedVoting; return { tier: score.tier, - score: showScore ? roundToTwoDecimalPlaces(score.score) : undefined, + score: showScore ? databaseAvgToPercentage(score.score) : undefined, passedVoting: score.passedVoting, }; }