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

{{ responses|length }}

Réponses reçues

{{ survey.responseRate }}%

Taux de réponse

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

Note moyenne

{{ survey.questions|length }}

Questions

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

Analyse détaillée par question

{% for question in survey.questions %}
{{ question.label }}
Type: {{ question.type|title }} {% if question.section %} {{ question.section }} {% endif %}
{% set questionResponses = [] %} {% for response in responses %} {% if response.answers[question.id] is defined and response.answers[question.id] %} {% set questionResponses = questionResponses|merge([{ 'answer': response.answers[question.id], 'submittedAt': response.submittedAt, 'responseId': response.id }]) %} {% endif %} {% endfor %}
{{ questionResponses|length }} réponse{{ questionResponses|length > 1 ? 's' : '' }}
{% if questionResponses|length > 0 %} {% if question.type == 'rating' %}
Distribution des notes
{% set ratingDistribution = {} %} {% set totalRating = 0 %} {% set ratingCount = 0 %} {% for responseItem in questionResponses %} {% if responseItem.answer and responseItem.answer != '' %} {% set answerAsNumber = responseItem.answer + 0 %} {% if answerAsNumber == responseItem.answer %} {% set rating = responseItem.answer|round %} {% set ratingDistribution = ratingDistribution|merge({ (rating): (ratingDistribution[rating] ?? 0) + 1 }) %} {% set totalRating = totalRating + rating %} {% set ratingCount = ratingCount + 1 %} {% endif %} {% endif %} {% endfor %} {% for rating in 1..(question.scale|default(5)) %} {% set count = ratingDistribution[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 %} {% if ratingCount > 0 %}
Note moyenne : {{ (totalRating / ratingCount)|round(1) }}/{{ question.scale|default(5) }}
{% endif %}
Réponses individuelles
{% for responseItem in questionResponses %}
{% if responseItem.answer and responseItem.answer != '' %} {% set answerAsNumber = responseItem.answer + 0 %} {% if answerAsNumber == responseItem.answer %} {% for i in 1..responseItem.answer %} {% endfor %} {{ responseItem.answer }}/{{ question.scale|default(5) }} {% endif %} {% endif %}
{{ responseItem.submittedAt|date('d/m H:i') }}
{% endfor %}
{% elseif question.type in ['radio', 'checkbox'] %}
Distribution des réponses
{% set choiceDistribution = {} %} {% for responseItem in questionResponses %} {% if responseItem.answer is iterable and responseItem.answer[0] is defined %} {% for choice in responseItem.answer %} {% set choiceDistribution = choiceDistribution|merge({ (choice): (choiceDistribution[choice] ?? 0) + 1 }) %} {% endfor %} {% else %} {% set choiceDistribution = choiceDistribution|merge({ (responseItem.answer): (choiceDistribution[responseItem.answer] ?? 0) + 1 }) %} {% endif %} {% endfor %} {% for choice, count in choiceDistribution %} {% set percentage = questionResponses|length > 0 ? ((count / questionResponses|length) * 100)|round : 0 %}
{{ choice }}
{% if count > 0 %} {{ count }} {% endif %}
{{ percentage }}%
{% endfor %}
Réponses individuelles
{% for responseItem in questionResponses %}
{% if responseItem.answer is iterable and responseItem.answer[0] is defined %} {{ responseItem.answer|join(', ') }} {% else %} {{ responseItem.answer }} {% endif %}
{{ responseItem.submittedAt|date('d/m H:i') }}
{% endfor %}
{% else %}
Toutes les réponses ({{ questionResponses|length }})
{% for responseItem in questionResponses %}

{{ responseItem.answer }}

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

Aucune réponse pour cette question

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

Toutes les réponses (données brutes)

{% if responses|length > 0 %}
{% for response in responses %} {% endfor %}
ID Date Nom Email Note Réponses Actions
#{{ response.id }} {{ response.submittedAt|date('d/m/Y H:i') }} {{ response.respondentName|default('-') }} {{ response.respondentEmail|default('-') }} {% if response.rating %}
{% for i in 1..response.rating %} {% endfor %} {{ response.rating }}/5
{% else %} - {% endif %}
Voir les {{ response.answers|length }} réponses
{% for questionId, answer in response.answers %}
{{ questionId }}: {% if answer is iterable and answer[0] is defined %} {{ answer|join(', ') }} {% else %} {{ answer }} {% endif %}
{% endfor %}
{% else %}

Aucune réponse pour cette enquête

{% endif %}

Actions

{% endblock %} {% block javascripts %} {{ parent() }} {% endblock %}