From 1933bc6e05f3a9273d97935757a4071a9ac4c19a Mon Sep 17 00:00:00 2001 From: Rayvented Date: Thu, 8 Feb 2024 14:00:32 +0100 Subject: [PATCH] Fix empty array error in akademie/index.html.twig --- templates/akademie/index.html.twig | 80 ++++++++++++++++-------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/templates/akademie/index.html.twig b/templates/akademie/index.html.twig index fde6abbc..8560c761 100644 --- a/templates/akademie/index.html.twig +++ b/templates/akademie/index.html.twig @@ -33,47 +33,53 @@ {{ b.zugewiesen|date('d.m.Y') }} {{ b.start|date('d.m.Y') }} - - {% if b.participations[0].state == 'finished' %} - {% trans from 'general' %}finished{% endtrans %} - {% else %} - {{ b.participations[0].state|trans }} - {% endif %} - - - {% if b.participations[0].state == 'finished' and b.participations[0].passed %} - - - - - {% endif %} - - - {% if b.participations[0].state == 'finished' %} - {% if b.participations[0].passed %} - - {{ 'result.success.button_cert'|trans }} - + {% if b.participations|length %} + + {% if b.participations[0].state == 'finished' %} + {% trans from 'general' %}finished{% endtrans %} {% else %} - - {% trans from 'questionnaire' %}retry{% endtrans %} - + {{ b.participations[0].state|trans }} + {% endif %} + + + {% if b.participations[0].state == 'finished' and b.participations[0].passed %} + + + + + {% endif %} + + + {% if b.participations[0].state == 'finished' %} + {% if b.participations[0].passed %} + + {{ 'result.success.button_cert'|trans }} + + {% else %} + + {% trans from 'questionnaire' %}retry{% endtrans %} + + {% endif %} {% endif %} - {% endif %} - {% if b.participations[0].state == 'ongoing' %} - - {% trans from 'general' %}continue{% endtrans %} - - {% else %} - {% if b.zugewiesen < today and b.user.akademieUser in b.kurs.team and b.participations[0].state == 'assigned' %} - - {% trans from 'general' %}start{% endtrans %} - + {% if b.participations[0].state == 'ongoing' %} + + {% trans from 'general' %}continue{% endtrans %} + + {% else %} + {% if b.zugewiesen < today and b.user.akademieUser in b.kurs.team and b.participations[0].state == 'assigned' %} + + {% trans from 'general' %}start{% endtrans %} + + {% endif %} {% endif %} - {% endif %} - + + {% else %} + - + - + - + {% endif %} {% endfor %}