Display number of items left to correct to admin on surveylist

This commit is contained in:
nemunaire 2022-11-19 17:22:50 +01:00
commit 6a54315626
2 changed files with 59 additions and 4 deletions

View file

@ -40,7 +40,11 @@
<th>Intitulé</th>
<th>Date</th>
{#if $user}
<th>Score</th>
{#if $user.is_admin}
<th>À corriger</th>
{:else}
<th>Score</th>
{/if}
{/if}
</tr>
</thead>
@ -84,14 +88,38 @@
</td>
{/if}
{#if $user}
{#if !survey.corrected}
{#if !survey.corrected && !$user.is_admin}
<td>N/A</td>
{:else}
<td>
{#await getScore(survey)}
<div class="spinner-border spinner-border-sm" role="status"></div>
{:then score}
{score.score}
{#if score.count !== undefined}
<span
class:fw-bolder={score.count-score.corrected > 0}
class:badge={survey.corrected}
class:bg-danger={survey.corrected && score.count-score.corrected > 0}
class:bg-dark={survey.corrected && score.count-score.corrected <= 0}
title="{score.count-score.corrected}/{score.count}"
>
{#if score.count == 0 || survey.corrected}
{score.count-score.corrected}
{:else}
{Math.trunc((1-score.corrected/score.count)*100)}&nbsp;%
{/if}
</span>
{:else}
<span
class="badge"
class:bg-success={score.score >= 18}
class:bg-info={score.score < 18 && score.score >= 15}
class:bg-warning={score.score < 15 && score.score >= 9}
class:bg-danger={score.score < 9}
>
{score.score}
</span>
{/if}
{:catch error}
<i class="bi text-warning bi-exclamation-triangle-fill" title={error}></i>
{/await}