Compare commits
No commits in common. "0cab193d6ce3bb919b213f10ee6bc5364b21e999" and "ee4872ff38c1d4d5826366088f06a8c8f36d7272" have entirely different histories.
0cab193d6c
...
ee4872ff38
@ -129,7 +129,7 @@
|
||||
class:bg-dark={survey.corrected && score.count-score.corrected <= 0}
|
||||
title="{score.count-score.corrected}/{score.count}"
|
||||
>
|
||||
{#if score.count == 0 || score.corrected == 0 || survey.corrected}
|
||||
{#if score.count == 0 || survey.corrected}
|
||||
{score.count-score.corrected}
|
||||
{:else}
|
||||
{Math.trunc((1-score.corrected/score.count)*100)} %
|
||||
@ -142,7 +142,6 @@
|
||||
class:bg-info={score.score < 18 && score.score >= 15}
|
||||
class:bg-warning={score.score < 15 && score.score >= 9}
|
||||
class:bg-danger={score.score < 9}
|
||||
class:bg-dark={score.score == "N/A"}
|
||||
>
|
||||
{score.score}
|
||||
</span>
|
||||
|
@ -1,5 +1,4 @@
|
||||
<script context="module">
|
||||
import CorrectionPieChart from '$lib/components/CorrectionPieChart.svelte';
|
||||
import { getSurvey } from '$lib/surveys';
|
||||
import { getUsers } from '$lib/users';
|
||||
|
||||
@ -28,7 +27,6 @@
|
||||
usersP = getUsers(s.promo, s.group);
|
||||
})
|
||||
let edit = false;
|
||||
let exportview = false;
|
||||
</script>
|
||||
|
||||
{#await surveyP then survey}
|
||||
@ -39,19 +37,12 @@
|
||||
class="ms-1 float-end"
|
||||
on:update={() => goto(`surveys/${survey.id}/admin`)}
|
||||
/>
|
||||
<button
|
||||
class="btn ms-1 float-end"
|
||||
class:btn-dark={exportview}
|
||||
class:btn-outline-dark={!exportview}
|
||||
title="Éditer"
|
||||
on:click={() => { exportview = !exportview; } }
|
||||
><i class="bi bi-activity"></i></button>
|
||||
{/if}
|
||||
<div class="d-flex align-items-center">
|
||||
<h2>
|
||||
<a href="surveys/{survey.id}" class="text-muted" style="text-decoration: none"><</a>
|
||||
{survey.title}
|
||||
<small class="text-muted">{#if exportview}Réponses{:else}Corrections{/if}</small>
|
||||
<small class="text-muted">Corrections</small>
|
||||
</h2>
|
||||
<SurveyBadge class="ms-2" {survey} />
|
||||
</div>
|
||||
@ -66,71 +57,49 @@
|
||||
<span>Chargement des questions …</span>
|
||||
</div>
|
||||
{:then questions}
|
||||
{#if !exportview}
|
||||
<div class="card mt-3 mb-5">
|
||||
<table class="table table-hover table-striped mb-0">
|
||||
<thead>
|
||||
<div class="card mt-3 mb-5">
|
||||
<table class="table table-hover table-striped mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Question</th>
|
||||
<th>Réponses</th>
|
||||
<th>Moyenne</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody ng-controller="SurveyGradesController">
|
||||
{#each questions as question (question.id)}
|
||||
<tr>
|
||||
<th>Question</th>
|
||||
<th>Réponses</th>
|
||||
<th>Moyenne</th>
|
||||
<td><a href="surveys/{survey.id}/responses/{question.id}">{question.title}</a></td>
|
||||
{#await question.getResponses()}
|
||||
<td colspan="2" class="text-center">
|
||||
<div class="spinner-border mx-3" role="status"></div>
|
||||
<span>Chargement …</span>
|
||||
</td>
|
||||
{:then responses}
|
||||
<td>
|
||||
{#if responses}
|
||||
{responses.filter((r) => !r.time_scored || (r.time_reported && r.time_reported >= r.time_scored)).length} /
|
||||
{responses.length}
|
||||
{#await usersP then users}
|
||||
<br>
|
||||
{Math.trunc(responses.length/users.length*1000)/10} %
|
||||
{/await}
|
||||
{:else}
|
||||
0
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
{#if responses && responses.filter((r) => r.time_scored).length}
|
||||
{Math.trunc(responses.reduce((p, c) => (p + (c.score?c.score:0)), 0)/responses.filter((r) => r.time_scored).length*10)/10} %
|
||||
{:else}
|
||||
-- %
|
||||
{/if}
|
||||
</td>
|
||||
{/await}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody ng-controller="SurveyGradesController">
|
||||
{#each questions as question (question.id)}
|
||||
<tr>
|
||||
<td><a href="surveys/{survey.id}/responses/{question.id}">{question.title}</a></td>
|
||||
{#await question.getResponses()}
|
||||
<td colspan="2" class="text-center">
|
||||
<div class="spinner-border mx-3" role="status"></div>
|
||||
<span>Chargement …</span>
|
||||
</td>
|
||||
{:then responses}
|
||||
<td>
|
||||
{#if responses}
|
||||
{responses.filter((r) => !r.time_scored || (r.time_reported && r.time_reported >= r.time_scored)).length} /
|
||||
{responses.length}
|
||||
{#await usersP then users}
|
||||
<br>
|
||||
{Math.trunc(responses.length/users.length*1000)/10} %
|
||||
{/await}
|
||||
{:else}
|
||||
0
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
{#if responses && responses.filter((r) => r.time_scored).length}
|
||||
{Math.trunc(responses.reduce((p, c) => (p + (c.score?c.score:0)), 0)/responses.filter((r) => r.time_scored).length*10)/10} %
|
||||
{:else}
|
||||
-- %
|
||||
{/if}
|
||||
</td>
|
||||
{/await}
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{:else}
|
||||
{#each questions as question (question.id)}
|
||||
<h3>{question.title}</h3>
|
||||
{#if question.kind == "text"}
|
||||
{#await question.getResponses() then responses}
|
||||
{#each responses as response (response.id)}
|
||||
<div class="card mb-2">
|
||||
<div class="card-body">
|
||||
<p class="card-text" style:white-space="pre-line">
|
||||
{response.value}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
{/await}
|
||||
{:else}
|
||||
<CorrectionPieChart {question} />
|
||||
{/if}
|
||||
<hr class="mb-3">
|
||||
{/each}
|
||||
{/if}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/await}
|
||||
{/await}
|
||||
|
Reference in New Issue
Block a user