diff --git a/ui/src/lib/components/SurveyList.svelte b/ui/src/lib/components/SurveyList.svelte index 166e1a6..b89ab62 100644 --- a/ui/src/lib/components/SurveyList.svelte +++ b/ui/src/lib/components/SurveyList.svelte @@ -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 || survey.corrected} + {#if score.count == 0 || score.corrected == 0 || survey.corrected} {score.count-score.corrected} {:else} {Math.trunc((1-score.corrected/score.count)*100)} % @@ -142,6 +142,7 @@ 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} diff --git a/ui/src/routes/surveys/[sid]/responses/index.svelte b/ui/src/routes/surveys/[sid]/responses/index.svelte index 28cfd4a..2a842a4 100644 --- a/ui/src/routes/surveys/[sid]/responses/index.svelte +++ b/ui/src/routes/surveys/[sid]/responses/index.svelte @@ -1,4 +1,5 @@ {#await surveyP then survey} @@ -37,12 +39,19 @@ class="ms-1 float-end" on:update={() => goto(`surveys/${survey.id}/admin`)} /> + {/if}

< {survey.title} - Corrections + {#if exportview}Réponses{:else}Corrections{/if}

@@ -57,49 +66,71 @@ Chargement des questions … {:then questions} -
- - - - - - - - - - {#each questions as question (question.id)} + {#if !exportview} +
+
QuestionRéponsesMoyenne
+ - - {#await question.getResponses()} - - {:then responses} - - - {/await} + + + - {/each} - -
{question.title} -
- Chargement … -
- {#if responses} - {responses.filter((r) => !r.time_scored || (r.time_reported && r.time_reported >= r.time_scored)).length} / - {responses.length} - {#await usersP then users} -
- {Math.trunc(responses.length/users.length*1000)/10} % - {/await} - {:else} - 0 - {/if} -
- {#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} - QuestionRéponsesMoyenne
-
+ + + {#each questions as question (question.id)} + + {question.title} + {#await question.getResponses()} + +
+ Chargement … + + {:then responses} + + {#if responses} + {responses.filter((r) => !r.time_scored || (r.time_reported && r.time_reported >= r.time_scored)).length} / + {responses.length} + {#await usersP then users} +
+ {Math.trunc(responses.length/users.length*1000)/10} % + {/await} + {:else} + 0 + {/if} + + + {#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} + + {/await} + + {/each} + + + + {:else} + {#each questions as question (question.id)} +

{question.title}

+ {#if question.kind == "text"} + {#await question.getResponses() then responses} + {#each responses as response (response.id)} +
+
+

+ {response.value} +

+
+
+ {/each} + {/await} + {:else} + + {/if} +
+ {/each} + {/if} {/await} {/await}