From d1c0418c89cef518b89d86a1fc484a6e40ce0805 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 10 Jan 2019 13:42:40 +0100 Subject: [PATCH] [#2180] Refactor - extract local variable --- app/models/procedure.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 05d1b33a8..ec972a7c0 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -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