{% extends 'new_base.html' %} {% set glob={'top_tracks': top_tracks,'top_releases': top_releases,'top_new_releases': top_new_releases,'top_physical_shipments': top_physical_shipments} %} {% set table_title={'top_tracks': 'Top Songs','top_releases': 'Top Products','top_new_releases': 'Top New Products','top_physical_shipments': 'Top Physical Shipments'} %} {% set table_description = { 'top_tracks': 'See the songs that earned the most streams between', 'top_releases': 'See the products that earned the most streams between', 'top_new_releases': 'Review the performance of your latest products, ranked by streams.', 'top_physical_shipments': 'Products listed below represent those with the most shipments across the US and Canada between' } %} {% set digest_list = [] %} {# Top Songs #} {% if top_tracks and top_tracks[0] %} {% do digest_list.append('top_tracks') %} {% endif %} {# Top Products #} {% if top_releases and top_releases[0] %} {% do digest_list.append('top_releases') %} {% endif %} {# Top New Products #} {% if top_new_releases and top_new_releases[0] %} {% do digest_list.append('top_new_releases') %} {% endif %} {# Top Physical Shipments #} {% if top_physical_shipments and top_physical_shipments[0] %} {% do digest_list.append('top_physical_shipments') %} {% endif %} {% set AWAL_BRAND = 'awal' %} {% if default_brand == AWAL_BRAND %} {% set MAIN_COLOR = '#FFFFFF' %} {% set SECONDARY_COLOR = '#A9A9B2' %} {% set ODD_BG_COLOR = '#303040'%} {% set ODD_COLOR = '#A9A9B2'%} {% set EVEN_BG_COLOR = '#22222B'%} {% set EVEN_COLOR = '#A9A9B2'%} {% else %} {% set MAIN_COLOR = '#1C1C1C' %} {% set SECONDARY_COLOR = '#847C7C' %} {% set ODD_BG_COLOR = '#F7F7F7'%} {% set ODD_COLOR = '#A8A0A0'%} {% set EVEN_BG_COLOR = '#ffffff'%} {% set EVEN_COLOR = '#847C7C'%} {% endif %} {% block styles %} {% endblock %} {% block header_title %} {{ account_name }}

{% trans %}Weekly Analytics{% endtrans %} {{ start_date|datetimeformat(date_format='%b %d') }} - {{ end_date|datetimeformat(date_format='%b %d') }}

{% endblock %} {% block content %} {% for category in digest_list %} {% if loop.index0 > 0 %} {% set margin_top = "margin-top:30px;" %} {% else %} {% set margin_top = "" %} {% endif %} {% if loop.index0 == digest_list|length-1 %} {% set margin_bottom = "margin-bottom:60px;" %} {% else %} {% set margin_bottom = "" %} {% endif %}

{% set title = table_title[category] %} {% trans %}{{title}}{% endtrans %}

{% set description = table_description[category] %} {% trans %}{{description}}{% endtrans %} {% if category != 'top_new_releases'%}  {{ start_date|datetimeformat(date_format='%b %d') }}  {% trans %}-{% endtrans %}  {{ end_date|datetimeformat(date_format='%b %d') }}. {% endif %}
{% if category != 'top_physical_shipments'%} {% for item in stores %} {% endfor %} {% endif %} {% for item in glob[category] %} {% if item.track_name|length > 14 %} {% set white_space = "normal" %} {% else %} {% set white_space = "nowrap" %} {% endif %} {% if (loop.index0 + 1) % 2 > 0 %} {% set table_row = "even_tr" %} {% set background_color = EVEN_BG_COLOR %} {% set text_color = EVEN_COLOR %} {% else %} {% set table_row = "odd_tr" %} {% set background_color = ODD_BG_COLOR %} {% set text_color = ODD_COLOR %} {% endif %} {% if category != 'top_physical_shipments'%} {% for store in stores %} {% endfor %} {% endif %} {% endfor %}
{% trans %}TITLE{% endtrans %} {% trans %}LAST WK{% endtrans %} {{ item }}
{{ (loop.index0 + 1) }}
{% if category == 'top_tracks' %} {{item.track_name}} {% elif category == 'top_physical_shipments' %} {{item.product_name}} {% if item.product_type %} {{ item.product_type|upper|replace_format() }} {% endif %} {% else %} {{item.release_name}} {% if item.release_format %} {{ item.release_format|upper|replace_format() }} {% endif %} {% endif %}
{{item.artist_name}} {{item.artist_names | format_artist_names()}}
{% if item.growth_percentage is defined and item.growth_percentage is not none %} {% if item.growth_percentage < -0.5 %} {% set growth_color = '#d54236' %} {% elif item.growth_percentage > 0.5 %} {% set growth_color = '#06a459' %} {% else %} {% set growth_color = MAIN_COLOR %} {% endif %}
{{item.total_streams | format_number() }}
{{ item.growth_percentage | format_growth_percentage }}
{% else %}
{{item.total_streams | format_number() }}
{% endif %}
{% if item.store_percentages is defined and item.store_percentages[store] is defined and item.store_percentages[store] is not none and item.store_percentages[store] != 'N/A' %}
{{ item.store_percentages[store].get('streams_per_store', '-') | format_number() }}
{% if item.store_percentages[store].get('growth_percentage_per_store') is defined and item.store_percentages[store].get('growth_percentage_per_store') is not none %} {% if item.store_percentages[store].get('growth_percentage_per_store') < -0.5 %} {% set growth_color = '#d54236' %} {% elif item.store_percentages[store].get('growth_percentage_per_store') > 0.5 %} {% set growth_color = '#06a459' %} {% else %} {% set growth_color = MAIN_COLOR %} {% endif %}
{{ item.store_percentages[store].get('growth_percentage_per_store') | format_growth_percentage }}
{% else %} {% if category != 'top_new_releases'%}
-
{% endif %} {% endif %} {% else %}
-
{% endif %}
{% endfor %} {% if notes %} {% endif %} {% endblock %}