Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Aug 23, 2024
1 parent 0e69db4 commit 2661ffa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
34 changes: 22 additions & 12 deletions resources/views/stats/find_rule_stats.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</p>

<div class="row">
<div class="col-md-5">
<h3>Top 10 Rules</h3>
<div class="col-12 col-md-6">
<h3>Top {{ count($rulesToCount) }} Rules</h3>

<table class="table table-bordered">
<thead class="table-dark">
Expand All @@ -27,6 +27,26 @@
@endforeach
</table>
</div>

<div class="col-12 col-md-6">
<h3>Top {{ count($setsToCount) }} Sets</h3>

<table class="table table-bordered">
<thead class="table-dark">
<tr>
<th>Set</th>
<th>Count</th>
</tr>
</thead>
@foreach ($setsToCount as $set => $count)
<tr>
<td>{{ $set }}</td>
<td class="text-right">{{ $count }}</td>
</tr>
@endforeach
</table>
</div>

<div class="col-md-3">
<h3>Queries</h3>

Expand All @@ -39,17 +59,7 @@
</ul>
</div>

<div class="col-md-4">
<h3>Sets ({{ $nonEmptySets }})</h3>

<ul>
@foreach ($setsToCount as $set => $count)
<li>
{{ $set }}:&nbsp;&nbsp;<strong>{{ $count }}</strong>
</li>
@endforeach
</ul>
</div>
</div>

<div class="clearfix"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Stats/FindRuleStatsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __invoke(): View
$sets = $this->getArrayFlattenKey($searchRecords, 'set');

$setsToCount = Arrays::groupToCount($sets, 4);
$setsToCount = array_slice($setsToCount, 0, 10);

// day by day stats
$timestamps = $this->getArrayFlattenKey($searchRecords, 'timestamp');
Expand All @@ -44,7 +45,6 @@ public function __invoke(): View
'queriesToCount' => $queriesToCount,
'setsToCount' => $setsToCount,
// counts
'nonEmptySets' => count($sets),
'rulesToCount' => $rulesToCount,
'datesToCount' => $datesToCount,
]);
Expand Down

0 comments on commit 2661ffa

Please sign in to comment.