mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Change db query for an existing method
This commit is contained in:
parent
ea8f12579d
commit
c055c91739
|
@ -668,9 +668,7 @@ class Helper
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($components as $component) {
|
foreach ($components as $component) {
|
||||||
$assets_count = \DB::table('components_assets')->where('component_id', $component->id)->sum('assigned_qty');
|
$avail = $component->numRemaining();
|
||||||
|
|
||||||
$avail = $component->qty - $assets_count;
|
|
||||||
if ($avail < ($component->min_amt) + \App\Models\Setting::getSettings()->alert_threshold) {
|
if ($avail < ($component->min_amt) + \App\Models\Setting::getSettings()->alert_threshold) {
|
||||||
if ($component->qty > 0) {
|
if ($component->qty > 0) {
|
||||||
$percent = number_format((($avail / $component->qty) * 100), 0);
|
$percent = number_format((($avail / $component->qty) * 100), 0);
|
||||||
|
|
Loading…
Reference in a new issue