{% import 'snippets/links.jinja' as links %}

{% set ranges = dbc.get_pulse(filterkeys,limitkeys,delimitkeys) %}

{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %}
{% if maxbar < 1 %}{% set maxbar = 1 %}{% endif %}

<table class="list">
	{% for t in ranges %}

	{% set thisrange = t.range %}
	<tr>
		<td>{{ thisrange.desc() }}</td>
		<td class="amount">
			{{ links.link_scrobbles([filterkeys,{'timerange':thisrange}],amount=t.scrobbles) }}
		</td>
		<td class="bar">
			{{ links.link_scrobbles([filterkeys,{'timerange':thisrange}],percent=t.scrobbles*100/maxbar) }}
		</td>
	</tr>
	{% endfor %}
</table>
