Files
myep-team/templates/admin/teamer/_mailing_skipped.html.twig
T
2026-08-11 16:25:53 +02:00

34 lines
1.5 KiB
Twig

{#- the reasons are prepositional phrases on purpose: an attributive adjective would have to
agree in number and gender ("1 gelöschte:r" / "2 gelöschte"), which reads badly next to
the gender neutral Teamer:innen and is not worth inflecting for a status line -#}
{%- set reasons = [] -%}
{%- if recipients.skippedNoEmail > 0 -%}
{%- set reasons = reasons|merge([{ 'count': recipients.skippedNoEmail, 'phrase': 'ohne E-Mail-Adresse' }]) -%}
{%- endif -%}
{%- if recipients.skippedDeleted > 0 -%}
{%- set reasons = reasons|merge([{ 'count': recipients.skippedDeleted, 'phrase': 'mit gelöschtem Account' }]) -%}
{%- endif -%}
{%- if recipients.skippedDisabled > 0 -%}
{%- set reasons = reasons|merge([{ 'count': recipients.skippedDisabled, 'phrase': 'mit gesperrtem Account' }]) -%}
{%- endif -%}
{%- set noun = recipients.skippedCount == 1 ? 'Teamer:in' : 'Teamer:innen' -%}
{%- set verb = recipients.skippedCount == 1 ? 'wird' : 'werden' -%}
{%- if reasons|length == 1 -%}
{#- one reason carries the whole count, so it reads as a single sentence -#}
{{- '%d %s %s %s übersprungen'|format(recipients.skippedCount, noun, reasons|first.phrase, verb) -}}
{%- else -%}
{%- set parts = [] -%}
{%- for reason in reasons -%}
{%- set parts = parts|merge(['%d %s'|format(reason.count, reason.phrase)]) -%}
{%- endfor -%}
{{- '%d %s %s übersprungen: %s und %s'|format(
recipients.skippedCount,
noun,
verb,
parts|slice(0, parts|length - 1)|join(', '),
parts|last
) -}}
{%- endif -%}