{% extends 'base.html' %} {% block main %}

{{ book.title }}

Author(s):

Category: {{ book.category }}

Year published: {{ book.year_published }}

Stack(s):

download {{ book.fileformat }}

Instances:

{% set got = {} %} {% set all = 1 %} {% for instance in book.instances %} {% if instance.name in got %} {% set x=got.__setitem__(instance.name, got[instance.name]+1) %} {% else %} {% set x=got.__setitem__(instance.name, 1) %} {% endif %} {% set all = loop.index %} {% endfor %} {% for instance, value in got.items() %} {% set result = value/(book.instances|length) %} {{ instance }}: {{ (result*100)|round|int }}%
{% endfor %}

edit
{% endblock %}