[#2180] Refactor - extract local variable

This commit is contained in:
Frederic Merizen 2019-01-10 13:42:40 +01:00
parent 530079e464
commit d1c0418c89

View file

@ -184,6 +184,8 @@ class Procedure < ApplicationRecord
end
def clone(admin, from_library)
is_different_admin = self.administrateur_id != admin.id
populate_champ_stable_ids
procedure = self.deep_clone(include:
{
@ -215,7 +217,7 @@ class Procedure < ApplicationRecord
if from_library
procedure.service = nil
elsif self.service.present? && (self.administrateur_id != admin.id)
elsif self.service.present? && is_different_admin
procedure.service = self.service.clone_and_assign_to_administrateur(admin)
end