{% extends 'base.html.twig' %} {% block title %}Résultats - {{ survey.title }}{% endblock %} {% block page_title %}Résultats de l'Enquête{% endblock %} {% block body %}

{{ survey.title }}

{{ survey.description }}

{{ survey.statusLabel }}

Total des réponses

{{ stats.totalResponses }}

Taux de réponse

{{ stats.responseRate }}%

Note moyenne

{% if stats.averageRating %} {{ stats.averageRating }}/5 {% else %} - {% endif %}

Questions

{{ survey.questions|length }}

{% if stats.timeStats|length > 0 %}

Évolution des réponses dans le temps

{% for date, count in stats.timeStats %}
{{ date|date('d/m') }}
{% set maxCount = 1 %} {% for d, c in stats.timeStats %} {% if c > maxCount %} {% set maxCount = c %} {% endif %} {% endfor %} {% set percentage = (count / maxCount * 100)|round %}
{{ count }}
{% endfor %}
{% endif %}
{% for questionId, questionStats in stats.questionStats %} {% set question = questionStats.question %} {% set distribution = questionStats.distribution %}

{{ question.label }}

Type: {% if question.type == 'text' %}Texte libre {% elseif question.type == 'email' %}Email {% elseif question.type == 'date' %}Date {% elseif question.type == 'textarea' %}Zone de texte {% elseif question.type == 'radio' %}Choix unique {% elseif question.type == 'checkbox' %}Choix multiple {% elseif question.type == 'rating' %}Évaluation {% else %}{{ question.type|title }} {% endif %} • {{ questionStats.answers|length }} réponse{{ questionStats.answers|length > 1 ? 's' : '' }}

{% if question.type == 'rating' %}
{% for rating in 1..(question.scale|default(5)) %} {% set count = distribution[rating] ?? 0 %} {% set percentage = questionStats.answers|length > 0 ? (count / questionStats.answers|length * 100)|round : 0 %}
{% for i in 1..rating %} {% endfor %}
{{ count }} ({{ percentage }}%)
{% endfor %}
{% elseif question.type in ['radio', 'checkbox'] %}
{% for option, count in distribution %} {% set percentage = questionStats.answers|length > 0 ? (count / questionStats.answers|length * 100)|round : 0 %}
{{ option }}
{{ count }} ({{ percentage }}%)
{% endfor %}
{% else %}
{% for answer in questionStats.answers|slice(0, 10) %} {% if answer and answer != '' %}
{{ answer|length > 200 ? answer|slice(0, 200) ~ '...' : answer }}
{% endif %} {% endfor %} {% if questionStats.answers|length > 10 %}
... et {{ questionStats.answers|length - 10 }} autres réponses
{% endif %}
{% endif %}
{% endfor %}

Exporter les résultats

{% if responses|length > 0 %}

Réponses individuelles ({{ responses|length }})

{% for response in responses|slice(0, 5) %}
Réponse #{{ response.id }} {% if response.rating %} • Note: {{ response.rating }}/5 {% for i in 1..response.rating %} {% endfor %} {% endif %}
{{ response.submittedAt|date('d/m/Y à H:i') }}
{% set answerCount = 0 %} {% for questionId, answer in response.answers %} {% if answerCount < 3 and answer and answer != '' %} {% set question = null %} {% for q in survey.questions %} {% if q.id == questionId %} {% set question = q %} {% endif %} {% endfor %} {% if question %}
{{ question.label }}: {% if answer is iterable and answer is not string %} {{ answer|join(', ') }} {% else %} {{ answer|length > 50 ? answer|slice(0, 50) ~ '...' : answer }} {% endif %}
{% set answerCount = answerCount + 1 %} {% endif %} {% endif %} {% endfor %} {% if response.answers|length > 3 %}
... et {{ response.answers|length - 3 }} autres réponses
{% endif %}
{% endfor %} {% if responses|length > 5 %}
... et {{ responses|length - 5 }} autres réponses
{% endif %}
{% endif %}
{% endblock %}