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

@ -9,8 +9,7 @@ class HomeController < ApplicationController
@unassigned_tasks = Task.order(:due_date).next_unassigned_tasks_for(current_user)
end
def profile
end
def profile; end
def reference_calculator
if current_user.ordergroup
@ -36,40 +35,43 @@ class HomeController < ApplicationController
@user = @current_user
@ordergroup = @user.ordergroup
unless @ordergroup.nil?
if @ordergroup.nil?
redirect_to root_path, alert: I18n.t('home.no_ordergroups')
else
@ordergroup = Ordergroup.include_transaction_class_sum.find(@ordergroup.id)
if params['sort']
sort = case params['sort']
when "date" then "created_on"
when "note" then "note"
when "amount" then "amount"
when "date_reverse" then "created_on DESC"
when "note_reverse" then "note DESC"
when "amount_reverse" then "amount DESC"
sort = if params['sort']
case params['sort']
when 'date' then 'created_on'
when 'note' then 'note'
when 'amount' then 'amount'
when 'date_reverse' then 'created_on DESC'
when 'note_reverse' then 'note DESC'
when 'amount_reverse' then 'amount DESC'
end
else
sort = "created_on DESC"
end
else
'created_on DESC'
end
@financial_transactions = @ordergroup.financial_transactions.visible.page(params[:page]).per(@per_page).order(sort)
@financial_transactions = @financial_transactions.where('financial_transactions.note LIKE ?', "%#{params[:query]}%") if params[:query].present?
if params[:query].present?
@financial_transactions = @financial_transactions.where('financial_transactions.note LIKE ?',
"%#{params[:query]}%")
end
else
redirect_to root_path, alert: I18n.t('home.no_ordergroups')
end
end
# cancel personal memberships direct from the myProfile-page
def cancel_membership
if params[:membership_id]
membership = @current_user.memberships.find(params[:membership_id])
else
membership = @current_user.memberships.find_by_group_id!(params[:group_id])
end
membership = if params[:membership_id]
@current_user.memberships.find(params[:membership_id])
else
@current_user.memberships.find_by_group_id!(params[:group_id])
end
membership.destroy
redirect_to my_profile_path, notice: I18n.t('home.ordergroup_cancelled', :group => membership.group.name)
redirect_to my_profile_path, notice: I18n.t('home.ordergroup_cancelled', group: membership.group.name)
end
protected
@ -82,8 +84,8 @@ class HomeController < ApplicationController
end
def ordergroup_params
if params[:user][:ordergroup]
params.require(:user).require(:ordergroup).permit(:contact_address)
end
return unless params[:user][:ordergroup]
params.require(:user).require(:ordergroup).permit(:contact_address)
end
end