Skip to content

A free open source IT asset/license management system

Adhere to include_assignments

Marcus Moore7888e665cc54
diff --git a/app/Http/Controllers/Reports/CustomComponentReportController.php b/app/Http/Controllers/Reports/CustomComponentReportController.php
index f02d301bec..9b2c0c8900 100644
--- a/app/Http/Controllers/Reports/CustomComponentReportController.php
+++ b/app/Http/Controllers/Reports/CustomComponentReportController.php
@@ -72,7 +72,7 @@ class CustomComponentReportController extends Controller
/** @var Component $component */
foreach ($components as $component) {
- $rowsToWrite = $component->qty;
+ $rowsToWrite = $request->filled('include_assignments') ? $component->qty : 1;
for ($i = 0; $i < $rowsToWrite; $i++) {
$count++;
diff --git a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
index 8da52d07a4..c631a82a7d 100644
--- a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
@@ -586,8 +586,6 @@ class CustomComponentReportTest extends TestCase
public function test_does_not_included_assignments_by_default()
{
- $this->markTestIncomplete('Need to honor include_assignments not being passed');
-
[$assetA, $assetB] = Asset::factory()
->count(2)
->sequence(
@@ -618,7 +616,8 @@ class CustomComponentReportTest extends TestCase
->assertSeeTextInStreamedResponse('Component C')
->assertDontSeeTextInStreamedResponse('Asset 001')
->assertDontSeeTextInStreamedResponse('Asset 002')
- ->assertRowCountInStreamedResponse(3);
+ // header + number of components
+ ->assertRowCountInStreamedResponse(4);
}
public function test_can_include_assignments()