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


{% macro medals(info) %}

<!-- MEDALS -->
{% for year in info.medals.gold -%}
<a title="Best Artist in {{ year }}" class="hidelink medal shiny gold" href='/charts_artists?max=50&amp;in={{ year }}'>
	<span>{{ year }}</span>
</a>
{%- endfor %}
{% for year in info.medals.silver -%}
<a title="Second best Artist in {{ year }}" class="hidelink medal shiny silver" href='/charts_artists?max=50&amp;in={{ year }}'>
	<span>{{ year }}</span>
</a>
{%- endfor %}
{% for year in info.medals.bronze -%}
<a title="Third best Artist in {{ year }}" class="hidelink medal shiny bronze" href='/charts_artists?max=50&amp;in={{ year }}'>
	<span>{{ year }}</span>
</a>
{%- endfor %}

{%- endmacro %}








{% macro topweeks(info) %}

{% set encodedartist = mlj_uri.uriencode({'artist':info.artist}) %}


<!-- TOPWEEKS -->
<span>
	{% if info.topweeks > 0 -%}
	<a title="{{ info.topweeks }} weeks on #1" href="/performance?{{ encodedartist }}&step=week">
		<img class="star" src="/media/star.png" />{{ info.topweeks }}</a>
	{%- endif %}
</span>

{%- endmacro %}









{% macro certs(artist) %}

<!-- CERTS -->

{% set charts = db.get_charts_tracks(artist=artist,timerange=malojatime.alltime()) %}
{% for e in charts -%}
	{%- if e.scrobbles >= settings.scrobbles_gold -%}{% set cert = 'gold' %}{%- endif -%}
	{%- if e.scrobbles >= settings.scrobbles_platinum -%}{% set cert = 'platinum' %}{%- endif -%}
	{%- if e.scrobbles >= settings.scrobbles_diamond -%}{% set cert = 'diamond' %}{%- endif -%}

	{%- if cert -%}
	<a href='{{ links.url(e.track) }}'><img class="certrecord_small"
					src="/media/record_{{ cert }}.png"
					title="{{ e.track.title }} has reached {{ cert.capitalize() }} status" /></a>
	{%- endif %}

{%- endfor %}

{%- endmacro %}
