{# team_result_breakdown: { blocks: list, total: int, rounding_footnote: string } #} {% if team_result_breakdown and team_result_breakdown.blocks is not empty %}
{% for block in team_result_breakdown.blocks %}

{{ block.title }}

    {% for step in block.steps %} {% set amount = null %} {% set calc = null %} {% set note = null %} {% if '→' in step.detail %} {% set arrow_parts = step.detail|split('→', 2) %} {% set calc = arrow_parts[0]|trim %} {% set after_arrow = arrow_parts[1]|trim %} {% if '—' in after_arrow %} {% set dash_parts = after_arrow|split('—', 2) %} {% set amount = dash_parts[0]|trim %} {% set note = dash_parts[1]|trim %} {% elseif '(' in after_arrow and after_arrow ends with 'pts)' %} {% set amount = after_arrow|split('(')|last|trim(' )') %} {% set note = calc ~ ' → ' ~ after_arrow|split('(')|first|trim %} {% set calc = null %} {% else %} {% set amount = after_arrow %} {% endif %} {% elseif step.detail starts with 'Variation' %} {% set amount = step.detail|split('(')|first|trim %} {% if '(' in step.detail %} {% set note = '(' ~ step.detail|split('(')|last %} {% endif %} {% elseif step.detail starts with '=' %} {% set calc = step.detail %} {% else %} {% set note = step.detail %} {% endif %}
  1. {{ step.label }} {% if step.formula or calc %} {{- step.formula -}} {%- if calc -%} {%- if step.formula %} {% endif -%} {{- calc -}} {%- endif -%} {% endif %} {% if note and not amount %} {{ note }} {% endif %}
    {% if amount %} {{ amount }}{% if step.has_rounding and 'pts*' not in amount %}*{% endif %} {% endif %}
    {% if note and amount %}

    {{ note }}

    {% endif %}
  2. {% endfor %}
Sous-total {{ block.subtotal > 0 ? '+' : '' }}{{ block.subtotal }} pts
{% endfor %}
Total équipe {{ team_result_breakdown.total > 0 ? '+' : '' }}{{ team_result_breakdown.total }} pts
{% if team_result_breakdown.rounding_footnote %}

{{ team_result_breakdown.rounding_footnote }}

{% endif %}
{% endif %}