chore: rubocop

chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
This commit is contained in:
Philipp Rothmann 2023-05-12 13:01:12 +02:00 committed by Philipp Rothmann
parent f6fb804bbe
commit fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions

View file

@ -5,7 +5,7 @@ class Finance::BalancingController < Finance::BaseController
def new
@order = Order.find(params[:order_id])
flash.now.alert = t('finance.balancing.new.alert') if @order.closed?
flash.now.alert = t('.alert') if @order.closed?
@comments = @order.comments
@articles = @order.order_articles.ordered_or_member.includes(:article, :article_price,
@ -13,13 +13,13 @@ class Finance::BalancingController < Finance::BaseController
sort_param = params['sort'] || 'name'
@articles = case sort_param
when 'name' then
when 'name'
@articles.order('articles.name ASC')
when 'name_reverse' then
when 'name_reverse'
@articles.order('articles.name DESC')
when 'order_number' then
when 'order_number'
@articles.order('articles.order_number ASC')
when 'order_number_reverse' then
when 'order_number_reverse'
@articles.order('articles.order_number DESC')
else
@articles
@ -31,13 +31,13 @@ class Finance::BalancingController < Finance::BaseController
def new_on_order_article_create # See publish/subscribe design pattern in /doc.
@order_article = OrderArticle.find(params[:order_article_id])
render :layout => false
render layout: false
end
def new_on_order_article_update # See publish/subscribe design pattern in /doc.
@order_article = OrderArticle.find(params[:order_article_id])
render :layout => false
render layout: false
end
def update_summary
@ -46,29 +46,29 @@ class Finance::BalancingController < Finance::BaseController
def edit_note
@order = Order.find(params[:id])
render :layout => false
render layout: false
end
def update_note
@order = Order.find(params[:id])
if @order.update(params[:order])
render :layout => false
render layout: false
else
render :action => :edit_note, :layout => false
render action: :edit_note, layout: false
end
end
def edit_transport
@order = Order.find(params[:id])
render :layout => false
render layout: false
end
def update_transport
@order = Order.find(params[:id])
@order.update!(params[:order])
redirect_to new_finance_order_path(order_id: @order.id)
rescue => error
redirect_to new_finance_order_path(order_id: @order.id), alert: t('errors.general_msg', msg: error.message)
rescue StandardError => e
redirect_to new_finance_order_path(order_id: @order.id), alert: t('errors.general_msg', msg: e.message)
end
# before the order will booked, a view lists all Ordergroups and its order_prices
@ -81,18 +81,18 @@ class Finance::BalancingController < Finance::BaseController
@order = Order.find(params[:id])
@type = FinancialTransactionType.find_by_id(params.permit(:type)[:type])
@order.close!(@current_user, @type)
redirect_to finance_order_index_url, notice: t('finance.balancing.close.notice')
rescue => error
redirect_to new_finance_order_url(order_id: @order.id), alert: t('finance.balancing.close.alert', message: error.message)
redirect_to finance_order_index_url, notice: t('.notice')
rescue StandardError => e
redirect_to new_finance_order_url(order_id: @order.id), alert: t('.alert', message: e.message)
end
# Close the order directly, without automaticly updating ordergroups account balances
def close_direct
@order = Order.find(params[:id])
@order.close_direct!(@current_user)
redirect_to finance_order_index_url, notice: t('finance.balancing.close_direct.notice')
rescue => error
redirect_to finance_order_index_url, alert: t('finance.balancing.close_direct.alert', message: error.message)
redirect_to finance_order_index_url, notice: t('.notice')
rescue StandardError => e
redirect_to finance_order_index_url, alert: t('.alert', message: e.message)
end
def close_all_direct_with_invoice
@ -103,8 +103,8 @@ class Finance::BalancingController < Finance::BaseController
count += 1
end
end
redirect_to finance_order_index_url, notice: t('finance.balancing.close_all_direct_with_invoice.notice', count: count)
rescue => error
redirect_to finance_order_index_url, alert: t('errors.general_msg', msg: error.message)
redirect_to finance_order_index_url, notice: t('.notice', count: count)
rescue StandardError => e
redirect_to finance_order_index_url, alert: t('errors.general_msg', msg: e.message)
end
end