Skip to content

Commit

Permalink
Feature snipe#9378 update
Browse files Browse the repository at this point in the history
  • Loading branch information
sh1hab committed May 21, 2021
1 parent cd4b1d8 commit f43413b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use App\Models\License;
use App\Models\Setting;
use Carbon\Carbon;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\View;
Expand Down Expand Up @@ -929,6 +930,7 @@ public function exportAssetMaintenancesReport()
* getAssetAcceptanceReport
*
* @return mixed
* @throws AuthorizationException
* @author Vincent Sposato <[email protected]>
* @version v1.0
*/
Expand All @@ -940,11 +942,11 @@ public function getAssetAcceptanceReport()
* Get all assets with pending checkout acceptances
*/

$acceptances = CheckoutAcceptance::pending()->get();
$acceptances = CheckoutAcceptance::pending()->with('assignedTo')->get();

$assetsForReport = $acceptances
->filter(function($acceptance) {
return $acceptance->checkoutable_type == 'App\Models\Asset';
return $acceptance->checkoutable_type == 'App\Models\Asset' && !is_null($acceptance->assignedTo);
})
->map(function($acceptance) {
return $acceptance->checkoutable;
Expand Down

0 comments on commit f43413b

Please sign in to comment.