mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Refactor for fewer queries
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
5ebf0ed2b2
commit
ebf6ce6980
|
@ -38,7 +38,7 @@ class AccessoriesTransformer
|
|||
'purchase_cost' => Helper::formatCurrencyOutput($accessory->purchase_cost),
|
||||
'order_number' => ($accessory->order_number) ? e($accessory->order_number) : null,
|
||||
'min_qty' => ($accessory->min_amt) ? (int) $accessory->min_amt : null,
|
||||
'remaining_qty' => (int) $accessory->numRemaining(),
|
||||
'remaining_qty' => (int) ($accessory->qty - $accessory->checkouts_count),
|
||||
'checkouts_count' => $accessory->checkouts_count,
|
||||
'created_by' => ($accessory->adminuser) ? [
|
||||
'id' => (int) $accessory->adminuser->id,
|
||||
|
@ -60,7 +60,7 @@ class AccessoriesTransformer
|
|||
|
||||
$permissions_array['user_can_checkout'] = false;
|
||||
|
||||
if ($accessory->numRemaining() > 0) {
|
||||
if (($accessory->qty - $accessory->checkouts_count) > 0) {
|
||||
$permissions_array['user_can_checkout'] = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue