{% set parent_tasks = [] %}
{% set child_tasks = {} %}
{# Group tasks by parent/child relationship #}
{% for t in rows %}
{% if t[0] and t[0]|length %}
{% if t[0] not in child_tasks %}
{% set _ = child_tasks.update({t[0]: []}) %}
{% endif %}
{% set _ = child_tasks[t[0]].append(t) %}
{% else %}
{% set _ = parent_tasks.append(t) %}
{% endif %}
{% endfor %}
{# Render parent tasks with their children #}
{% for t in parent_tasks %}
{% if t[1] in child_tasks %}
▶{% endif %}
{% if t[5] == "pending" and t[4] == "scheduled" %}
{{t[8]}}
{% else %}
{{t[8]}}
{% endif %}
{{t[3]}}
{{t[6][:-7]}}
{{t[7][:-7]}}
{{t[4]}}
{{t[5]}}
{% if t[1] in child_tasks %}
{% for child in child_tasks[t[1]] %}
{% endfor %}
{% endif %}