{% 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

{{ responses|length }}

Taux de réponse

{{ survey.responseRate }}%

Note moyenne

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

Questions

{{ survey.questions|length }}

{% if survey.questions|length > 0 %}

Analyse détaillée par question

{% set currentSection = '' %} {% for question in survey.questions %} {% if question.section != currentSection %} {% set currentSection = question.section %}

{{ currentSection }}

{% endif %}
{{ question.label }}
{{ question.type|title }} {% if question.required %} Obligatoire {% endif %}
{% set questionResponses = [] %} {% set responseDistribution = {} %} {% for response in responses %} {% if response.answers[question.id] is defined %} {% set answer = response.answers[question.id] %} {% set questionResponses = questionResponses|merge([{ 'answer': answer, 'submittedAt': response.submittedAt, 'responseId': response.id }]) %} {% if answer is iterable and answer is not string %} {% for subAnswer in answer %} {% set responseDistribution = responseDistribution|merge({ (subAnswer): (responseDistribution[subAnswer] ?? 0) + 1 }) %} {% endfor %} {% elseif answer and answer != '' %} {% set responseDistribution = responseDistribution|merge({ (answer): (responseDistribution[answer] ?? 0) + 1 }) %} {% endif %} {% endif %} {% endfor %}
{{ questionResponses|length }} réponse{{ questionResponses|length > 1 ? 's' : '' }} {% if responses|length > 0 %} ({{ ((questionResponses|length / responses|length) * 100)|round }}% de taux de réponse) {% endif %}
{% if questionResponses|length > 0 %} {% if question.type == 'rating' %}
Distribution des notes
{% for rating in 1..(question.scale|default(5)) %} {% set count = responseDistribution[rating] ?? 0 %} {% set percentage = questionResponses|length > 0 ? ((count / questionResponses|length) * 100)|round : 0 %}
{% for i in 1..rating %} {% endfor %}
{% if count > 0 %} {{ count }} {% endif %}
{{ percentage }}%
{% endfor %} {% set totalRating = 0 %} {% set ratingCount = 0 %} {% for response in questionResponses %} {% if response.answer is numeric %} {% set totalRating = totalRating + response.answer %} {% set ratingCount = ratingCount + 1 %} {% endif %} {% endfor %} {% if ratingCount > 0 %}
Note moyenne : {{ (totalRating / ratingCount)|round(1) }}/{{ question.scale|default(5) }}
{% endif %}
Réponses individuelles
{% for response in questionResponses|slice(0, 10) %}
{% for i in 1..response.answer %} {% endfor %} {{ response.answer }}/{{ question.scale|default(5) }}
{{ response.submittedAt|date('d/m H:i') }}
{% endfor %} {% if questionResponses|length > 10 %}
... et {{ questionResponses|length - 10 }} autres réponses
{% endif %}
{% elseif question.type in ['radio', 'checkbox'] %}
Distribution des réponses
{% for option, count in responseDistribution %} {% set percentage = questionResponses|length > 0 ? ((count / questionResponses|length) * 100)|round : 0 %}
{{ option }}
{% if count > 0 %} {{ count }} {% endif %}
{{ percentage }}%
{% endfor %}
Réponses individuelles
{% for response in questionResponses|slice(0, 8) %}
{% if response.answer is iterable and response.answer is not string %} {{ response.answer|join(', ') }} {% else %} {{ response.answer }} {% endif %}
{{ response.submittedAt|date('d/m H:i') }}
{% endfor %} {% if questionResponses|length > 8 %}
... et {{ questionResponses|length - 8 }} autres réponses
{% endif %}
{% else %}
Toutes les réponses
{% for response in questionResponses %} {% if response.answer and response.answer != '' %}

{{ response.answer }}

{{ response.submittedAt|date('d/m/Y H:i') }}
{% endif %} {% endfor %}
{% endif %} {% else %}

Aucune réponse pour cette question

{% endif %}
{% endfor %}
{% endif %}

Exporter les résultats

{% endblock %}