updated rating display

rating percentages where showing long decimal ranges, so a quick tweak
as added to make them clean whole numbers.
This commit is contained in:
ro 2024-04-14 15:04:36 -06:00
parent a109b1b5c1
commit e9c238a922
3 changed files with 10 additions and 4 deletions

View file

@ -17,8 +17,11 @@
<article> <article>
<h2>Found {{count($results)}} results for {{$terms}}</h2> <h2>Found {{count($results)}} results for {{$terms}}</h2>
@foreach($results as $item) @foreach($results as $item)
@php
$rating = floor(($item->actions_count / $sources)*100);
@endphp
<a class="list-link" role="listitem" href="/location/{{$item->uuid}}"> <a class="list-link" role="listitem" href="/location/{{$item->uuid}}">
<span class="item-rating">{{($item->actions_count / $sources)*100}}%</span> <span class="item-rating">{{$rating}}%</span>
<label class="item-name">{{$item->name}}</label> <label class="item-name">{{$item->name}}</label>
<div class="item-silence"> <div class="item-silence">
<img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" /> <img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
@ -38,7 +41,10 @@
<h2>Recent Updates</h2> <h2>Recent Updates</h2>
@foreach($recent as $item) @foreach($recent as $item)
<a class="list-link" role="listitem" href="/location/{{$item->uuid}}"> <a class="list-link" role="listitem" href="/location/{{$item->uuid}}">
<span class="item-rating">{{($item->actions_count / $sources)*100}}%</span> @php
$rating = floor(($item->actions_count / $sources)*100);
@endphp
<span class="item-rating">{{$rating}}%</span>
<label class="item-name">{{$item->name}}</label> <label class="item-name">{{$item->name}}</label>
<div class="item-silence"> <div class="item-silence">
<img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" /> <img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" />

View file

@ -11,7 +11,7 @@
@foreach($locations as $location) @foreach($locations as $location)
@php @php
$action = $location->block_count + $location->silence_count; $action = $location->block_count + $location->silence_count;
$rating = ($action / $sources)*100; $rating = floor(($action / $sources)*100);
@endphp @endphp
<a class="list-link" role="listitem" href="/location/{{$location->uuid}}"> <a class="list-link" role="listitem" href="/location/{{$location->uuid}}">
<span class="item-rating">{{$rating}}%</span> <span class="item-rating">{{$rating}}%</span>

View file

@ -18,7 +18,7 @@
@endif @endif
@php @php
$action = $location->block_count + $location->silence_count; $action = $location->block_count + $location->silence_count;
$rating = ($action / $sources_count)*100; $rating = floor(($action / $sources_count)*100);
@endphp @endphp
<h3>Links</h3> <h3>Links</h3>
<div class="location-rating"> <div class="location-rating">