Better product time selection for supplier products view

This commit is contained in:
2013-12-24 16:03:22 +01:00
parent 101cbd62e5
commit 50a95fa6fb
4 changed files with 40 additions and 7 deletions
@@ -86,7 +86,8 @@ module Suppliers
end
def preview_products
@time = Time.parse(params[:date]) rescue Time.now
#TODO: time zone correction, since the hour and minute are of the supplier time zone, not the system time zone
@time = Time.parse("#{params[:date]}T#{params[:hour]}:#{params[:minute]}:00") rescue Time.now
product_categories = ProductCategory.for_supplier_in_time(current_supplier, @time)
render json: {categories: product_categories.map(&:to_client_format).select(&:present?)}
end