ui: Add more grade stats
This commit is contained in:
parent
cc729227ce
commit
0b192e4783
@ -16,7 +16,7 @@
|
|||||||
let warn_already_used = false;
|
let warn_already_used = false;
|
||||||
let w = null;
|
let w = null;
|
||||||
let gradesP = null;
|
let gradesP = null;
|
||||||
let mean = 0;
|
let stats = {"mean": 0, "min": 999, "max": 0};
|
||||||
|
|
||||||
$: w = data.work;
|
$: w = data.work;
|
||||||
$: refresh_submission(data.work);
|
$: refresh_submission(data.work);
|
||||||
@ -34,8 +34,10 @@
|
|||||||
let sum = 0;
|
let sum = 0;
|
||||||
for (const grade of grades) {
|
for (const grade of grades) {
|
||||||
sum += grade.score;
|
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>
|
</script>
|
||||||
@ -64,7 +66,12 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<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
|
<button
|
||||||
class="btn btn-light"
|
class="btn btn-light"
|
||||||
on:click={() => refresh_grades(w)}
|
on:click={() => refresh_grades(w)}
|
||||||
@ -79,14 +86,13 @@
|
|||||||
<span>Chargement des notes …</span>
|
<span>Chargement des notes …</span>
|
||||||
</div>
|
</div>
|
||||||
{:then grades}
|
{:then grades}
|
||||||
|
<p>
|
||||||
|
|
||||||
<table class="table table-hover table-striped table-sm mb-0">
|
<table class="table table-hover table-striped table-sm mb-0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Login</th>
|
<th>Login</th>
|
||||||
<th>
|
<th>Note</th>
|
||||||
Note
|
|
||||||
{#if mean > 0}(moyenne : {Math.round(mean*100)/100}){/if}
|
|
||||||
</th>
|
|
||||||
<th>Commentaire</th>
|
<th>Commentaire</th>
|
||||||
<th>Date de la note</th>
|
<th>Date de la note</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
Reference in New Issue
Block a user