Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class CurrentOrders::ArticlesController < ApplicationController
|
||||
|
||||
before_action :authenticate_orders
|
||||
before_action :find_order_and_order_article, only: [:index, :show]
|
||||
|
||||
|
|
@ -21,7 +19,7 @@ class CurrentOrders::ArticlesController < ApplicationController
|
|||
end
|
||||
|
||||
def show_on_group_order_article_update
|
||||
#@goa = GroupOrderArticle.find(params[:group_order_article_id])
|
||||
# @goa = GroupOrderArticle.find(params[:group_order_article_id])
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
@ -40,7 +38,7 @@ class CurrentOrders::ArticlesController < ApplicationController
|
|||
end
|
||||
|
||||
helper_method \
|
||||
def ordergroups_for_adding
|
||||
def ordergroups_for_adding
|
||||
Ordergroup.undeleted.order(:name)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ class CurrentOrders::GroupOrdersController < ApplicationController
|
|||
def index
|
||||
# XXX code duplication lib/foodsoft_current_orders/app/controllers/current_orders/ordergroups_controller.rb
|
||||
@order_ids = Order.where(state: ['open', 'finished']).all.map(&:id)
|
||||
@goas = GroupOrderArticle.includes(:group_order => :ordergroup).includes(:order_article).
|
||||
where(group_orders: {order_id: @order_ids, ordergroup_id: @ordergroup.id}).ordered
|
||||
@articles_grouped_by_category = @goas.includes(:order_article => {:article => :article_category}).
|
||||
order('articles.name').
|
||||
group_by { |a| a.order_article.article.article_category.name }.
|
||||
sort { |a, b| a[0] <=> b[0] }
|
||||
@goas = GroupOrderArticle.includes(:group_order => :ordergroup).includes(:order_article)
|
||||
.where(group_orders: { order_id: @order_ids, ordergroup_id: @ordergroup.id }).ordered
|
||||
@articles_grouped_by_category = @goas.includes(:order_article => { :article => :article_category })
|
||||
.order('articles.name')
|
||||
.group_by { |a| a.order_article.article.article_category.name }
|
||||
.sort { |a, b| a[0] <=> b[0] }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -22,5 +22,4 @@ class CurrentOrders::GroupOrdersController < ApplicationController
|
|||
redirect_to root_url, :alert => I18n.t('group_orders.errors.no_member')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class CurrentOrders::OrdergroupsController < ApplicationController
|
||||
|
||||
before_action :authenticate_orders
|
||||
before_action :find_group_orders, only: [:index, :show]
|
||||
|
||||
|
|
@ -21,7 +19,7 @@ class CurrentOrders::OrdergroupsController < ApplicationController
|
|||
end
|
||||
|
||||
def show_on_group_order_article_update
|
||||
#@goa = GroupOrderArticle.find(params[:group_order_article_id])
|
||||
# @goa = GroupOrderArticle.find(params[:group_order_article_id])
|
||||
@group_order = GroupOrder.find(params[:group_order_id])
|
||||
@ordergroup = @group_order.ordergroup
|
||||
end
|
||||
|
|
@ -33,15 +31,15 @@ class CurrentOrders::OrdergroupsController < ApplicationController
|
|||
|
||||
@all_ordergroups = Ordergroup.undeleted.order(:name).to_a
|
||||
@ordered_group_ids = GroupOrder.where(order_id: @order_ids).pluck('DISTINCT(ordergroup_id)')
|
||||
@all_ordergroups.sort_by! {|o| @ordered_group_ids.include?(o.id) ? o.name : "ZZZZZ#{o.name}" }
|
||||
@all_ordergroups.sort_by! { |o| @ordered_group_ids.include?(o.id) ? o.name : "ZZZZZ#{o.name}" }
|
||||
|
||||
@ordergroup = Ordergroup.find(params[:id]) unless params[:id].nil?
|
||||
@goas = GroupOrderArticle.includes(:group_order, :order_article => [:article, :article_price]).
|
||||
where(group_orders: {order_id: @order_ids, ordergroup_id: @ordergroup.id}).ordered.all unless @ordergroup.nil?
|
||||
@goas = GroupOrderArticle.includes(:group_order, :order_article => [:article, :article_price])
|
||||
.where(group_orders: { order_id: @order_ids, ordergroup_id: @ordergroup.id }).ordered.all unless @ordergroup.nil?
|
||||
end
|
||||
|
||||
helper_method \
|
||||
def articles_for_adding
|
||||
def articles_for_adding
|
||||
OrderArticle.includes(:article, :article_price).where(order_id: @order_ids)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class CurrentOrders::OrdersController < ApplicationController
|
||||
|
||||
before_action :authenticate_orders, except: :my
|
||||
|
||||
def show
|
||||
|
|
@ -14,8 +13,8 @@ class CurrentOrders::OrdersController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.pdf do
|
||||
pdf = case params[:document]
|
||||
when 'groups' then MultipleOrdersByGroups.new(@order_ids, @doc_options)
|
||||
when 'articles' then MultipleOrdersByArticles.new(@order_ids, @doc_options)
|
||||
when 'groups' then MultipleOrdersByGroups.new(@order_ids, @doc_options)
|
||||
when 'articles' then MultipleOrdersByArticles.new(@order_ids, @doc_options)
|
||||
end
|
||||
send_data pdf.to_pdf, filename: pdf.filename, type: 'application/pdf'
|
||||
end
|
||||
|
|
@ -36,5 +35,4 @@ class CurrentOrders::OrdersController < ApplicationController
|
|||
def receive
|
||||
@orders = Order.finished_not_closed.includes(:supplier)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class CurrentOrdersController < ApplicationController
|
||||
|
||||
before_action :authenticate_orders
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue