Skip to content

Commit

Permalink
Merge pull request #15270 from snipe/fixes/make_dashboard_pie_respect…
Browse files Browse the repository at this point in the history
…_show_in_list

Fixed #15247 - make pie chart on dashboard respect the “show archived…
  • Loading branch information
snipe authored Aug 12, 2024
2 parents 9d354ca + ac1543d commit c9f8a84
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Http/Controllers/Api/StatuslabelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -187,8 +188,14 @@ public function destroy($id) : JsonResponse
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) {

Expand Down

0 comments on commit c9f8a84

Please sign in to comment.