End of week commit

This commit is contained in:
2014-04-18 20:38:13 +02:00
parent 2a5331471c
commit 821f59b761
42 changed files with 304 additions and 91 deletions
+14 -1
View File
@@ -3,7 +3,20 @@ module Suppliers
# GET /lists
# GET /lists.json
def index
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
if params[:date].present?
@date = params[:date].present? ? (Date.parse(params[:date]) rescue Date.today) : Date.today
@time = @date.to_time(:utc)
@start_time = @time.beginning_of_day
@end_time = @time.end_of_day
if current_supplier.night_offset.present?
@start_time += current_supplier.night_offset.to_f.hours
@end_time += current_supplier.night_offset.to_f.hours
end
@lists = List.for_supplier_created_at current_supplier, @start_time..@end_time
@lists.include_relation(:table) # for number
else
@lists = List.for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
end
@lists.include_relation(:table)
respond_to do |format|