{% from 'magpie/parts.html' import provider, pair, integer, count, estimate, failure with context %}

{{ t.text('magpie.live.title') }}

{% include 'magpie/live.html' %}

{{ t.text('magpie.live.stats') }}

{% if statistics %}{{ t.text('magpie.live.attempt_count', {'count': integer(statistics | sum(attribute='tries'))}) }} · {{ t.text('magpie.live.failure_count', {'count': integer(statistics | sum(attribute='failed'))}) }}{% endif %}
{% if errors.get('usage/requests') %}{{ failure(errors['usage/requests'], t) }}{% else %} {% for speed in statistics %} {{ provider(speed.provider, speed.get('provider_name'), speed.model, speed.get('icon','')) }} {% set reasons %}{% for reason, amount in speed.reasons.items() %}{{ t.text('magpie.reason.' ~ reason) }} {{ t.text('magpie.live.times', {'count': integer(amount)}) }}{% if not loop.last %} · {% endif %}{% endfor %}{% endset %} {{ reasons | trim }} {{ t.text('magpie.live.attempt_count', {'count': integer(speed.tries)}) }}{{ t.text('magpie.live.failure_count', {'count': integer(speed.failed)}) }}{% include 'server/icons/chevron-right.svg' %} {% else %}

{{ t.text('magpie.live.no_stats') }}

{% endfor %} {% endif %}