calculate the number of days it takes until the stock might be gone
This commit is contained in:
parent
e88fbb9d8e
commit
2df27fca52
|
@ -42,8 +42,10 @@ module Spree
|
||||||
else
|
else
|
||||||
name = "Sku " + var.sku
|
name = "Sku " + var.sku
|
||||||
end
|
end
|
||||||
|
days = var.count_on_hand / mean
|
||||||
|
|
||||||
{'weighted_mean' => mean, 'variant' => var, 'product' => var.product, 'name' => name}
|
{'weighted_mean' => mean, 'days' => days, 'variant' => var,
|
||||||
|
'product' => var.product, 'name' => name}
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_forecast()
|
def generate_forecast()
|
||||||
|
|
|
@ -5,7 +5,7 @@ will run low.
|
||||||
|
|
||||||
Estimates:
|
Estimates:
|
||||||
<% @forecast.each do |dict| %>
|
<% @forecast.each do |dict| %>
|
||||||
<%= dict['name'] %> => <%= dict['weighted_mean'].round(2) %> days until sold out.
|
<%= dict['name'] %> => <%= dict['days'].round(2) %> days until sold out.
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue