{% extends 'events/surveys/management/_survey_base.html' %} {% block subtitle %} {% trans title=survey.title %}Results for "{{ title }}"{% endtrans %} {% endblock %} {% block content %}
{% trans count=survey.submissions|length %} One person responded to this survey {% pluralize %} {{ count }} people responded to this survey {% endtrans %}
{% for section in survey.sections if section.children %} {% if section.display_as_section %}

{{ section.title }}

{% endif %} {% for question in section.children if question.type.name == 'question' %}
{{ question.title }}
{% if question.description %}
{{ question.description }}
{% endif %}
{% if question.not_empty_answers %} {% if question.field_type == 'text' %} {{ text_answer(question) }} {% elif question.field_type == 'number' %} {{ number_answer(question) }} {% elif question.field_type == 'single_choice' %} {{ single_choice_answer(question) }} {% elif question.field_type == 'bool' %} {{ single_choice_answer(question, short_labels=false) }} {% elif question.field_type == 'multiselect' %} {{ multiple_choice_answer(question) }} {% endif %} {% else %}
{% trans %}No answer has been recorded for this question.{% endtrans %}
{% endif %}
{% endfor %} {% endfor %}
{% endblock %} {% macro text_answer(question) %} {% for answer in question.get_summary() %}
{{ answer }}
{% endfor %} {% endmacro %} {% macro number_answer(question) %} {% set summary = question.get_summary() %}
{% trans %}Average:{% endtrans %} {{ '%0.2f'|format(summary.average) }}
{% trans %}Min:{% endtrans %} {{ summary.min }}
{% trans %}Max:{% endtrans %} {{ summary.max }}
{{ _chart('bar', summary) }} {% endmacro %} {% macro single_choice_answer(question, short_labels=true) %} {{ _choice_answer(question, 'pie', short_labels=short_labels) }} {% endmacro %} {% macro multiple_choice_answer(question) %} {{ _choice_answer(question, 'bar', short_labels=true) }} {% endmacro %} {% macro _choice_answer(question, chart_type, short_labels=false) %} {% set summary = question.get_summary() %}
{% for label, value in summary.relative.iteritems() %}
{{ loop.index0|alpha_enum|upper }}. {{ label }}: {{ summary.absolute[label] }} ({{ '%0.2f'|format(value * 100) }}%)
{% endfor %}
{{ _chart(chart_type, summary, short_labels=short_labels) }} {% endmacro %} {% macro _chart(chart_type, summary, short_labels=false) %}
{% if chart_type == 'bar' %}
{% trans %}Answers{% endtrans %}
{% trans %}# of times chosen{% endtrans %}
{% endif %}
{% endmacro %}