diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php index 269c7e4c..824923cb 100644 --- a/src/Services/ProjectSystem/ProjectBuildHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildHelper.php @@ -63,17 +63,19 @@ class ProjectBuildHelper */ public function getMaximumBuildableCount(Project $project): int { + $bom_entries = $project->getBomEntries(); + if ($bom_entries->isEmpty()) { + return 0; + } $maximum_buildable_count = PHP_INT_MAX; - foreach ($project->getBomEntries() as $bom_entry) { + foreach ($bom_entries as $bom_entry) { //Skip BOM entries without a part (as we can not determine that) if (!$bom_entry->isPartBomEntry()) { continue; } - //The maximum buildable count for the whole project is the minimum of all BOM entries $maximum_buildable_count = min($maximum_buildable_count, $this->getMaximumBuildableCountForBOMEntry($bom_entry)); } - return $maximum_buildable_count; } diff --git a/templates/projects/build/build.html.twig b/templates/projects/build/build.html.twig index 783c3794..6489256d 100644 --- a/templates/projects/build/build.html.twig +++ b/templates/projects/build/build.html.twig @@ -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 %}