mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-09 20:49:30 +00:00
Fix Wrong default number of project builds if BOM is empty #1038
This commit is contained in:
parent
7a1a458abe
commit
05839a549c
3 changed files with 18 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue