mirror of
https://github.com/grocy/grocy.git
synced 2025-08-28 17:10:11 +00:00
Fixed that "Spoil rate" and "Average shelf life" on the product card was wrong in most cases
This commit is contained in:
@@ -115,7 +115,7 @@ class StockService extends BaseService
|
||||
$lastPrice = $lastLogRow->price;
|
||||
}
|
||||
|
||||
$consumeCount = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_CONSUME)->where('undone', 0)->sum('amount') * -1;
|
||||
$consumeCount = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_CONSUME)->where('undone = 0 AND spoiled = 0')->sum('amount') * -1;
|
||||
$consumeCountSpoiled = $this->Database->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_CONSUME)->where('undone = 0 AND spoiled = 1')->sum('amount') * -1;
|
||||
if ($consumeCount == 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user