Fix Wrong default number of project builds if BOM is empty #1038

This commit is contained in:
Marc 2025-09-18 11:04:52 +00:00 committed by Jan Böhmer
parent 7a1a458abe
commit 05839a549c
3 changed files with 18 additions and 8 deletions

View file

@ -8,7 +8,8 @@
{% endblock %}
{% block card_content %}
{% set can_build = buildHelper.projectBuildable(project, number_of_builds) %}
{% set bom_empty = project.bomEntries | length == 0 %}
{% set can_build = not bom_empty and buildHelper.projectBuildable(project, number_of_builds) %}
{% import "components/projects.macro.html.twig" as project_macros %}
{% if project.status is not empty and project.status != "in_production" %}
@ -18,7 +19,10 @@
{% endif %}
<div class="alert {% if can_build %}alert-success{% else %}alert-danger{% endif %}" role="alert">
{% if not can_build %}
{% if bom_empty %}
<h5><i class="fa-solid fa-circle-exclamation fa-fw"></i> {% trans %}project.builds.no_bom_entries{% endtrans %}</h5>
<span class="text-muted">{% trans %}project.builds.no_bom_entries_hint{% endtrans %}</span>
{% elseif not can_build %}
<h5><i class="fa-solid fa-circle-exclamation fa-fw"></i> {% trans %}project.builds.build_not_possible{% endtrans %}</h5>
<b>{% trans with {"%number_of_builds%": number_of_builds} %}project.builds.following_bom_entries_miss_instock_n{% endtrans %}</b>
<ul>