Verified Commit 25d9463d authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

some rubocop linter happyness

parent 78e60290
......@@ -74,7 +74,7 @@ class ClientsController < ApplicationController
message: 'Beenden fehlgeschlagen.',
model_message: @client.errors.messages[:acceptance].first,
action_link: { text: 'Begleitung bearbeiten',
path: edit_assignment_path(@client.assignment) }
path: edit_assignment_path(@client.assignment) }
})
end
end
......
......@@ -110,13 +110,15 @@ class Client < ApplicationRecord
language_skills.german.blank?
end
private
# allow ransack to use the scopes
def self.ransackable_scopes(_auth_object = nil)
['active', 'inactive']
end
private_class_method :ransackable_scopes
private
def going_to_change_to_resigned?
will_save_change_to_acceptance?(to: 'resigned')
end
......
......@@ -30,7 +30,9 @@ module GroupAssignmentAndAssignmentCommon
scope :start_after, ->(date) { where("#{model_name.plural}.period_start > ?", date) }
scope :start_at_or_after, ->(date) { where("#{model_name.plural}.period_start >= ?", date) }
scope :start_within, ->(date_range) { where(period_start: date_range) }
scope :started_six_months_ago, (-> { where("#{model_name.plural}.period_start < ?", 6.months.ago) })
scope :started_six_months_ago, lambda {
where("#{model_name.plural}.period_start < ?", 6.months.ago)
}
scope :started_ca_six_weeks_ago, lambda {
start_at_or_after(8.weeks.ago).start_at_or_before(6.weeks.ago)
}
......
......@@ -8,16 +8,16 @@ class ClientPolicy < ApplicationPolicy
end
# controller action policies
alias_method :index?, :superadmin_or_department_manager_or_social_worker?
alias_method :search?, :superadmin_or_department_manager_or_social_worker?
alias_method :new?, :superadmin_or_department_manager_or_social_worker?
alias_method :create?, :superadmin_or_department_manager_or_social_worker?
alias_method :show?, :superadmin_or_department_manager_or_social_worker?
alias_method :edit?, :superadmin_or_record_owner?
alias_method :update?, :superadmin_or_record_owner?
alias_method :termination?, :superadmin_or_department_managers_record?
alias_method :index?, :superadmin_or_department_manager_or_social_worker?
alias_method :search?, :superadmin_or_department_manager_or_social_worker?
alias_method :new?, :superadmin_or_department_manager_or_social_worker?
alias_method :create?, :superadmin_or_department_manager_or_social_worker?
alias_method :show?, :superadmin_or_department_manager_or_social_worker?
alias_method :edit?, :superadmin_or_record_owner?
alias_method :update?, :superadmin_or_record_owner?
alias_method :termination?, :superadmin_or_department_managers_record?
alias_method :set_resigned?, :superadmin_or_department_managers_record?
alias_method :destroy?, :superadmin?
alias_method :destroy?, :superadmin?
# suplementary policies
alias_method :superadmin_privileges?, :superadmin?
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment