From: Toshi MARUYAMA Date: Fri, 3 Jul 2020 11:45:21 +0000 (+0000) Subject: fix source indent of lib/redmine/nested_set/issue_nested_set.rb X-Git-Tag: 4.2.0~947 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cb568dfd567c34048cc358a999c5fe4630ef5991;p=redmine.git fix source indent of lib/redmine/nested_set/issue_nested_set.rb git-svn-id: http://svn.redmine.org/redmine/trunk@19848 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/nested_set/issue_nested_set.rb b/lib/redmine/nested_set/issue_nested_set.rb index ec9db78a4..e43b2f943 100644 --- a/lib/redmine/nested_set/issue_nested_set.rb +++ b/lib/redmine/nested_set/issue_nested_set.rb @@ -56,11 +56,13 @@ module Redmine self.root_id = parent.root_id self.lft = target_lft self.rgt = lft + 1 - self.class.where(:root_id => root_id).where("lft >= ? OR rgt >= ?", lft, lft).update_all([ - "lft = CASE WHEN lft >= :lft THEN lft + 2 ELSE lft END, " + - "rgt = CASE WHEN rgt >= :lft THEN rgt + 2 ELSE rgt END", - {:lft => lft} - ]) + self.class.where(:root_id => root_id).where("lft >= ? OR rgt >= ?", lft, lft).update_all( + [ + "lft = CASE WHEN lft >= :lft THEN lft + 2 ELSE lft END, " + + "rgt = CASE WHEN rgt >= :lft THEN rgt + 2 ELSE rgt END", + {:lft => lft} + ] + ) end def add_as_root @@ -88,17 +90,19 @@ module Redmine self.root_id = parent.root_id lft_after_move = target_lft - self.class.where(:root_id => parent.root_id).update_all([ - "lft = CASE WHEN lft >= :lft THEN lft + :shift ELSE lft END, " + - "rgt = CASE WHEN rgt >= :lft THEN rgt + :shift ELSE rgt END", - {:lft => lft_after_move, :shift => (rgt - lft + 1)} - ]) - - self.class.where(:root_id => previous_root_id).update_all([ - "root_id = :root_id, lft = lft + :shift, rgt = rgt + :shift", - {:root_id => parent.root_id, :shift => lft_after_move - lft} - ]) - + self.class.where(:root_id => parent.root_id).update_all( + [ + "lft = CASE WHEN lft >= :lft THEN lft + :shift ELSE lft END, " + + "rgt = CASE WHEN rgt >= :lft THEN rgt + :shift ELSE rgt END", + {:lft => lft_after_move, :shift => (rgt - lft + 1)} + ] + ) + self.class.where(:root_id => previous_root_id).update_all( + [ + "root_id = :root_id, lft = lft + :shift, rgt = rgt + :shift", + {:root_id => parent.root_id, :shift => lft_after_move - lft} + ] + ) self.lft, self.rgt = lft_after_move, (rgt - lft + lft_after_move) parent.send :reload_nested_set_values end @@ -108,11 +112,13 @@ module Redmine self.class.where(:root_id => root_id).where("lft >= ? AND rgt <= ?", lft, rgt). update_all(["root_id = :id, lft = lft - :shift, rgt = rgt - :shift", {:id => id, :shift => lft - 1}]) - self.class.where(:root_id => root_id).update_all([ - "lft = CASE WHEN lft >= :lft THEN lft - :shift ELSE lft END, " + - "rgt = CASE WHEN rgt >= :lft THEN rgt - :shift ELSE rgt END", - {:lft => lft, :shift => rgt - lft + 1} - ]) + self.class.where(:root_id => root_id).update_all( + [ + "lft = CASE WHEN lft >= :lft THEN lft - :shift ELSE lft END, " + + "rgt = CASE WHEN rgt >= :lft THEN rgt - :shift ELSE rgt END", + {:lft => lft, :shift => rgt - lft + 1} + ] + ) self.root_id = id self.lft, self.rgt = 1, (rgt - lft + 1) end @@ -125,11 +131,13 @@ module Redmine children.each {|c| c.send :destroy_without_nested_set_update} reload unless @without_nested_set_update - self.class.where(:root_id => root_id).where("lft > ? OR rgt > ?", lft, lft).update_all([ - "lft = CASE WHEN lft > :lft THEN lft - :shift ELSE lft END, " + - "rgt = CASE WHEN rgt > :lft THEN rgt - :shift ELSE rgt END", - {:lft => lft, :shift => rgt - lft + 1} - ]) + self.class.where(:root_id => root_id).where("lft > ? OR rgt > ?", lft, lft).update_all( + [ + "lft = CASE WHEN lft > :lft THEN lft - :shift ELSE lft END, " + + "rgt = CASE WHEN rgt > :lft THEN rgt - :shift ELSE rgt END", + {:lft => lft, :shift => rgt - lft + 1} + ] + ) end end