Verified Commit 1c558cdb authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

fix acceptance collection in policy and typo

parent 3ae564db
......@@ -39,7 +39,7 @@ class Client < ApplicationRecord
validates :acceptance, exclusion: {
in: ['resigned'],
message: 'Klient/in kann nicht beendet werden, solange noch ein laufendes Tandem existiert.'
}, unless: :terminateable?
}, unless: :terminatable?
scope :with_assignment, (-> { joins(:assignment) })
scope :with_active_assignment, (-> { with_assignment.merge(Assignment.active) })
......@@ -69,7 +69,7 @@ class Client < ApplicationRecord
accepted.without_assignment.or(with_inactive_assignment)
}
def terminateable?
def terminatable?
assignment.blank? || assignment.ending? || assignment.no_period?
end
......
......@@ -22,9 +22,9 @@ class ClientPolicy < ApplicationPolicy
alias_method :superadmin_privileges?, :superadmin?
def acceptance_collection
if superadmin?
if superadmin_or_department_managers_record?
Client.acceptance_collection
elsif department_managers_record?
else
Client.acceptance_collection_restricted
end
end
......
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