{% macro choices(poll) %}
<fieldset>
{% for choice in poll.choices %}
    <input type="radio" id="{{ poll.id }}-{{ choice.id }}" name="pollanwsers" value="{{ choice.title }}" />
    <label for="{{ poll.id }}-{{ choice.id }}">{{ choice.title }}</label><br>
{% endfor %}
</fieldset>
{% endmacro %}

{% macro results(poll) %}
<table>
    {% for choice, votes in poll.results.most_common() %}
    <tr>
        <td><label for="{{ poll.id }}-{{ choice.id }}">{{ choice.title }}</label></td>
        <td>
            <progress id="{{ poll.id }}-{{ choice.id }}" value="{{ votes }}" max="{{ len(poll.answers) }}">
                {{ votes / len(poll.answers) if len(poll.answers) else 0 }} % ({{ votes }})
            </progress>
        </td>
    </tr>
    {% endfor %}
</table>
{% endmacro %}
