Add pie chart for MCQ/UCQ

This commit is contained in:
nemunaire 2022-05-01 12:59:53 +02:00
commit e852f7c76a
4 changed files with 98 additions and 3 deletions

View file

@ -13,6 +13,7 @@
<script lang="ts">
import Correction from '../../../../components/Correction.svelte';
import CorrectionPieChart from '../../../../components/CorrectionPieChart.svelte';
import CorrectionReference from '../../../../components/CorrectionReference.svelte';
import SurveyBadge from '../../../../components/SurveyBadge.svelte';
import QuestionHeader from '../../../../components/QuestionHeader.svelte';
@ -22,6 +23,7 @@
export let surveyP;
export let rid;
let showChart = false;
let showResponses = false;
let showStudent = false;
let notCorrected = false;
@ -106,6 +108,18 @@
{/if}
</button>
{/if}
{#if question.kind == "ucq" || question.kind == "mcq"}
<button
type="button"
class="btn btn-sm float-end mx-1"
class:btn-outline-info={!showChart}
class:btn-info={showChart}
on:click={() => showChart = !showChart}
title="Afficher les résultats"
>
<i class="bi bi-bar-chart-line-fill"></i>
</button>
{/if}
<button
type="button"
class="btn btn-sm float-end mx-1"
@ -137,6 +151,12 @@
templates={correctionTemplates}
/>
{/if}
{#if showChart}
<CorrectionPieChart
{question}
class="card-body"
/>
{/if}
</div>
<Correction