{# Full finishing-order + dividend detail shown inside the betting wizard for a leg whose race is already closed/settled, in place of its horse picker. `details` is raceResults[race.id] from PlayController::buildLiveRacingCards() ({settled, dividendRows}), or null when the race has a result but is not settled yet. #} {% macro leg_result(leg, details) %} {% set race = leg.race %} {% set horses = leg.horses %}
Winner {%- if race.result is not null and race.result is not empty -%} {%- for finisher in race.result -%} {{- not loop.first ? '/' : '' }}{{ finisher.horseNumber -}} {%- endfor -%} {%- else -%}—{%- endif -%}
{% set scratchedAfterClose = horses|filter(h => h.scratchedAfterClose) %} {% if scratchedAfterClose is not empty %}
Scratched (after close) {%- for h in scratchedAfterClose -%} {{ not loop.first ? ', ' : '' }}#{{ h.horseNumber }} {%- endfor -%}
{% endif %} {% if details.dividendRows is not empty %}
Dividends
{% for row in details.dividendRows %}
{{ row.label }}{% if row.kind == 'multi' %} combo{% endif %} {%- if row.refund -%}Refunded{%- endif -%} {%- for c in row.combinations -%} {{- not loop.first ? ' · ' : (row.refund ? ' · ' : '') -}} {%- if c.selection %}{{ c.selection|capitalize }}{% else %}{{ c.numbers|join('-') }}{% endif %} ₱{{ c.dividend }} {%- else -%} {%- if not row.refund %}—{% endif -%} {%- endfor -%}
{% endfor %}
{% elseif not details.settled %}
Dividends pending settlement.
{% endif %}
{% endmacro %}