From ac1543d5682e9194e81ad8cc09e38eb80d38567d Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 12 Aug 2024 17:54:42 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20#15247=20-=20make=20pie=20chart=20on=20?= =?UTF-8?q?dashboard=20respect=20the=20=E2=80=9Cshow=20archived=E2=80=9D?= =?UTF-8?q?=20setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- app/Http/Controllers/Api/StatuslabelsController.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index 95ac5956fa..ce61d653f5 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -8,6 +8,7 @@ use App\Http\Transformers\AssetsTransformer; use App\Http\Transformers\SelectlistTransformer; use App\Http\Transformers\StatuslabelsTransformer; use App\Models\Asset; +use App\Models\Setting; use App\Models\Statuslabel; use Illuminate\Http\Request; use App\Http\Transformers\PieChartTransformer; @@ -187,8 +188,14 @@ class StatuslabelsController extends Controller public function getAssetCountByStatuslabel() : array { $this->authorize('view', Statuslabel::class); - $statuslabels = Statuslabel::withCount('assets')->get(); - $total = Array(); + + if (Setting::getSettings()->show_archived_in_list == 0 ) { + $statuslabels = Statuslabel::withCount('assets')->where('archived','0')->get(); + } else { + $statuslabels = Statuslabel::withCount('assets')->get(); + } + + $total = []; foreach ($statuslabels as $statuslabel) {