add rating as we go

This commit is contained in:
Tommy Parnell
2024-05-17 19:32:00 -04:00
parent 12231a0eda
commit ceb8fb613a
2 changed files with 5 additions and 1 deletions

View File

@@ -4,7 +4,7 @@
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
"build": "vite build", "build": "vite build",
"publish": "NODE_ENV=production vite build && gh-pages -d build -t true", "publish": "pnpm run check && pnpm run lint && NODE_ENV=production vite build && gh-pages -d build -t true",
"preview": "vite preview", "preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",

View File

@@ -10,6 +10,7 @@
$: currentScoreEditing = scoreEditing > -1 ? currentGameEditing.scores[scoreEditing] : null; $: currentScoreEditing = scoreEditing > -1 ? currentGameEditing.scores[scoreEditing] : null;
$: gamesComplete = $storedGames.filter((g) => g.isComplete); $: gamesComplete = $storedGames.filter((g) => g.isComplete);
$: gamesCompletedWithRating = calculateRatingForGames(gamesComplete); $: gamesCompletedWithRating = calculateRatingForGames(gamesComplete);
$: currentGameRating = calculateRating([currentGameEditing]);
$: completedStats = calculateTotalGameStats(gamesComplete); $: completedStats = calculateTotalGameStats(gamesComplete);
$: disableEditing = currentGameEditing.isComplete && scoreEditing === -1; $: disableEditing = currentGameEditing.isComplete && scoreEditing === -1;
$: storedGames; $: storedGames;
@@ -186,6 +187,9 @@
<section> <section>
<div class="stats"> <div class="stats">
<div>Score {currentGameEditing.totalScore}</div> <div>Score {currentGameEditing.totalScore}</div>
<div>
Rating: {currentGameRating}
</div>
<div> <div>
Throw: {currentGameEditing.scores.length < 10 Throw: {currentGameEditing.scores.length < 10
? currentGameEditing.scores.length + 1 ? currentGameEditing.scores.length + 1