{% macro user(list, index) %} {% if list[index] is defined %}{{ list[index].user_id|user_url }}{% else %} {% endif %} {% endmacro %} {% macro total(list, index) %} {% if list[index] is defined %}{{ list[index].total|number_format }}{% else %} {% endif %} {% endmacro %} {% macro accrual(d) %} {% if d is defined %}{{ d.total|number_format }}{% else %}—{% endif %} {% endmacro %} {% macro delta(interval, n) %} {% set p = n - 1 %} {% if interval[n] is defined and interval[p] is defined %}{{ (interval[p].total - interval[n].total)|number_format }} {% elseif interval[n] is defined %}{{ interval[n].total|number_format }} {% elseif interval[p] is defined %}{{ -interval[p].total|number_format }} {% else %}—{% endif %} {% endmacro %} {% set max = 6 %}

Accrual

{% for n in range(1, max) %} {% endfor %} {% for n in range(1, max) %} {% endfor %} {% for n in range(1, max) %} {% endfor %} {% for n in range(1, max) %} {% endfor %}
Interval CurrentΔ n-{{ n }}
Day {{ _self.accrual(day.0) }}{{ _self.delta(day, n) }}
Week {{ _self.accrual(week.0) }}{{ _self.delta(week, n) }}
Month {{ _self.accrual(month.0) }}{{ _self.delta(month, n) }}

Item Purchases

{% set item = bonus.itemPurchase %} {% set day = bonus.expenditureRange('DAY', 0, 1) %} {% set week = bonus.expenditureRange('WEEK', 0, 1) %} {% set month = bonus.expenditureRange('MONTH', 0, 1) %} {% set quarter = bonus.expenditureRange('WEEK', 0, 13) %} {% set year = bonus.expenditureRange('YEAR', 0, 1) %} {% for i in item %} {% endfor %}
Item Last day Last week Last month Last quarter Last year Total
{{ i.title }} {{ day[i.id].total|number_format }} {{ week[i.id].total|number_format }} {{ month[i.id].total|number_format }} {{ quarter[i.id].total|number_format }} {{ year[i.id].total|number_format }} {{ i.total|number_format }}

Top 10 Users

{% set limit = 10 %} {% set hoarders = bonus.topHoarders(limit) %} {% set spenders = bonus.topSpenders(limit) %} {% set poolers = bonus.topPoolContributors(limit) %} {% set overall = bonus.topAggregateSpenders(limit) %} {% for i in range(0, limit - 1) %} {% endfor %}
  Hoarders Spenders Pool Contributors Overall Spenders  
  Points User Points User Points User Points User  
{{ i + 1 }} {{ _self.total(hoarders, i) }} {{ _self.user(hoarders, i) }} {{ _self.total(spenders, i) }} {{ _self.user(spenders, i) }} {{ _self.total(poolers, i) }} {{ _self.user(poolers, i) }} {{ _self.total(overall, i) }} {{ _self.user(overall, i) }} {{ i + 1 }}