function _commerce_reports_stock_calculate_lifetime in Commerce Reporting 7.4
Same name and namespace in other branches
- 7.3 modules/stock/commerce_reports_stock.module \_commerce_reports_stock_calculate_lifetime()
Calculate the stock lifetime.
Parameters
int $stock: The current stock count.
int $weekly_burn: The weekly burn.
Return value
int The length of the current stock's lifetime.
1 call to _commerce_reports_stock_calculate_lifetime()
- _commerce_reports_stock_calculate_dataset in modules/
stock/ commerce_reports_stock.module - Calculate all the stock reports data.
File
- modules/
stock/ commerce_reports_stock.module, line 155 - This module provides advanced stock reporting for Drupal Commerce.
Code
function _commerce_reports_stock_calculate_lifetime($stock, $weekly_burn) {
// Why does this mean it is 1000?
if ($weekly_burn === 0) {
return 1000;
}
return (int) ($stock / ($weekly_burn / 7));
}