Commit a54c50d1 authored by James Lopez's avatar James Lopez

remove relation after used from the hash tree

parent 025a2688
...@@ -57,7 +57,7 @@ module Gitlab ...@@ -57,7 +57,7 @@ module Gitlab
else else
relation_key = relation.is_a?(Hash) ? relation.keys.first : relation relation_key = relation.is_a?(Hash) ? relation.keys.first : relation
relation_hash_list = @tree_hash[relation_key.to_s] relation_hash_list = @tree_hash[relation_key.to_s]
save_relation_hash(relation_hash_list, relation_key, saved) save_relation_hash(relation_hash_list, relation_key, @saved)
end end
...@@ -82,10 +82,7 @@ module Gitlab ...@@ -82,10 +82,7 @@ module Gitlab
relation_hash = create_relation(relation_key, relation_hash_batch) relation_hash = create_relation(relation_key, relation_hash_batch)
@saved << restored_project.append_or_update_attribute(relation_key, relation_hash) @saved << restored_project.append_or_update_attribute(relation_key, relation_hash)
@restored_project = nil @restored_project = Project.find_by_id(@project_id)
@project = nil
@project = Project.find_by_id(@project_id)
end end
def default_relation_list def default_relation_list
...@@ -117,7 +114,6 @@ module Gitlab ...@@ -117,7 +114,6 @@ module Gitlab
# #
# Recursively calls this method if the sub-relation is a hash containing more sub-relations # Recursively calls this method if the sub-relation is a hash containing more sub-relations
def create_sub_relations(relation, tree_hash, save = true) def create_sub_relations(relation, tree_hash, save = true)
tree_hash = tree_hash.dup
relation_key = relation.keys.first.to_s relation_key = relation.keys.first.to_s
return if tree_hash[relation_key].blank? return if tree_hash[relation_key].blank?
...@@ -133,6 +129,7 @@ module Gitlab ...@@ -133,6 +129,7 @@ module Gitlab
end end
save_relation_hash([relation_item], relation_key) if save save_relation_hash([relation_item], relation_key) if save
tree_hash.delete(relation_key) if save
end end
end end
......
Markdown is supported
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