{% extends 'base.html' %} {% block main %}
Author(s):
Category: {{ book.category }}
Year published: {{ book.year_published }}
Stack(s):
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 }}%