Skip to content

A free open source IT asset/license management system

Implement updated before

Marcus Moorebaa9ec157670
diff --git a/app/Http/Controllers/Reports/CustomComponentReportController.php b/app/Http/Controllers/Reports/CustomComponentReportController.php
index e05bc657b3..7d4c73f01d 100644
--- a/app/Http/Controllers/Reports/CustomComponentReportController.php
+++ b/app/Http/Controllers/Reports/CustomComponentReportController.php
@@ -101,6 +101,11 @@ class CustomComponentReportController extends Controller
'last_updated' => 'updated_at',
]);
+ if (($request->filled('last_updated_before'))) {
+ $last_updated_window = Carbon::parse(today()->subDays($request->input('last_updated_before')));
+ $query->where('components.updated_at', '<', $last_updated_window);
+ }
+
if ($request->input('deleted_components') === 'include_deleted') {
$query->withTrashed();
}
diff --git a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
index e7cea7eb49..286bb452c5 100644
--- a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
@@ -454,8 +454,6 @@ class CustomComponentReportTest extends TestCase
public function test_limiting_by_updated_before()
{
- $this->markTestIncomplete();
-
$this->travel(-60)->days(function () {
Component::factory()->create(['name' => 'Component A']);
});