Filter unaccepted assets that are not assigned to users

This commit is contained in:
Ivan Nieto Vivanco 2023-09-07 13:39:16 -06:00
parent ec5238ff06
commit abd2ed3b81

View file

@ -1021,7 +1021,7 @@ class ReportsController extends Controller
$assetsForReport = $acceptances
->filter(function ($acceptance) {
return $acceptance->checkoutable_type == 'App\Models\Asset';
return $acceptance->checkoutable_type == 'App\Models\Asset' && $acceptance->checkoutable->checkedOutToUser();
})
->map(function($acceptance) {
return ['assetItem' => $acceptance->checkoutable, 'acceptance' => $acceptance];