Description
There is a need to add a snippet tag that aggregates the given value from each object given in the list.
Use-case
Sending a promotional campaign only to customers whose deals exceed the value of USD 100.
To-do
Add a snippet tag called aggregate, with parameters:
list of json objects
the name of the attribute to be aggregated
aggregation method name - sum ("sum" parameter) or average ("avg" parameter)
Example
{% aggregate deal_list function="sum" attribute="value" as values_sum %}where the deal list "deal_list" can be generated with a snippet of the deal tag, i.e.:
{% deals for_last_days=1 count=5 filter_by='created_at' order_by='created_at' order=1 as deal_list %}