{# SPDX-FileCopyrightText: 2025 CERN. SPDX-License-Identifier: MIT #} {# FIXME: This logic should be computed on the backend in the CheckRun #} {# Get the icon class for the overall severity level of all rule errors. This code depends on the `severity` field of the each `errors`. #} {% import "invenio_checks/requests/severity_level_icons.html" as severity_level_icons_tpl %} {# A namespaced variable is used so that the variable is still defined after the loop #} {% set ns = namespace(overall_severity_level="success") %} {% for check in checks %} {% if check.config.check_cls.id == check_class_id or not check_class_id %} {% for error in check.result.errors %} {% if error.severity == "info" and ns.overall_severity_level not in ["error", "warning"] %} {% set ns.overall_severity_level = "info" %} {% elif error.severity == "warning" and ns.overall_severity_level != "error" %} {% set ns.overall_severity_level = "warning" %} {% elif error.severity == "error" %} {% set ns.overall_severity_level = "error" %} {% endif %} {% endfor %} {% set status = check.status.name %} {% if ns.overall_severity_level == "success" and (status == "PENDING" or status == "RUNNING") %} {% set ns.overall_severity_level = "running" %} {% endif %} {% endif %} {% endfor %} {{ severity_level_icons_tpl.severity_level_icons[ns.overall_severity_level] }}