ui: Add more grade stats

This commit is contained in:
nemunaire 2023-03-06 12:17:12 +01:00
parent cc729227ce
commit 0b192e4783
1 changed files with 13 additions and 7 deletions

View File

@ -16,7 +16,7 @@
let warn_already_used = false;
let w = null;
let gradesP = null;
let mean = 0;
let stats = {"mean": 0, "min": 999, "max": 0};
$: w = data.work;
$: refresh_submission(data.work);
@ -34,8 +34,10 @@
let sum = 0;
for (const grade of grades) {
sum += grade.score;
if (stats.min > grade.score) stats.min = grade.score;
if (stats.max < grade.score) stats.max = grade.score;
}
mean = sum / grades.length;
stats.mean = sum / grades.length;
});
}
</script>
@ -64,7 +66,12 @@
<hr>
<div class="d-flex justify-content-between align-items-center">
<h3 class="mt-3">Notes</h3>
<h3 class="mt-3">
Notes
<small class="text-muted">
{#if stats.mean > 0}(moyenne&nbsp;: {Math.round(stats.mean*100)/100}, min&nbsp;: {stats.min}, max&nbsp;: {stats.max}){/if}
</small>
</h3>
<button
class="btn btn-light"
on:click={() => refresh_grades(w)}
@ -79,14 +86,13 @@
<span>Chargement des notes &hellip;</span>
</div>
{:then grades}
<p>
<table class="table table-hover table-striped table-sm mb-0">
<thead>
<tr>
<th>Login</th>
<th>
Note
{#if mean > 0}(moyenne&nbsp;: {Math.round(mean*100)/100}){/if}
</th>
<th>Note</th>
<th>Commentaire</th>
<th>Date de la note</th>
</tr>