ui: Add more grade stats
This commit is contained in:
parent
cc729227ce
commit
0b192e4783
@ -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 : {Math.round(stats.mean*100)/100}, min : {stats.min}, max : {stats.max}){/if}
|
||||
</small>
|
||||
</h3>
|
||||
<button
|
||||
class="btn btn-light"
|
||||
on:click={() => refresh_grades(w)}
|
||||
@ -79,14 +86,13 @@
|
||||
<span>Chargement des notes …</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 : {Math.round(mean*100)/100}){/if}
|
||||
</th>
|
||||
<th>Note</th>
|
||||
<th>Commentaire</th>
|
||||
<th>Date de la note</th>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user