Project

General

Profile

Patch #32909 » pick.patch

Pavel Rosický, 2020-01-28 23:03

View differences:

app/models/issue_query.rb (working copy)
559 559
        "1=0"
560 560
      end
561 561
    when "~"
562
      root_id, lft, rgt = Issue.where(:id => value.first.to_i).pluck(:root_id, :lft, :rgt).first
562
      root_id, lft, rgt = Issue.where(:id => value.first.to_i).pick(:root_id, :lft, :rgt)
563 563
      if root_id && lft && rgt
564 564
        "#{Issue.table_name}.root_id = #{root_id} AND #{Issue.table_name}.lft > #{lft} AND #{Issue.table_name}.rgt < #{rgt}"
565 565
      else
......
584 584
        "1=0"
585 585
      end
586 586
    when "~"
587
      root_id, lft, rgt = Issue.where(:id => value.first.to_i).pluck(:root_id, :lft, :rgt).first
587
      root_id, lft, rgt = Issue.where(:id => value.first.to_i).pick(:root_id, :lft, :rgt)
588 588
      if root_id && lft && rgt
589 589
        "#{Issue.table_name}.root_id = #{root_id} AND #{Issue.table_name}.lft < #{lft} AND #{Issue.table_name}.rgt > #{rgt}"
590 590
      else
app/models/user.rb (working copy)
635 635
      return @project_ids_by_role if @project_ids_by_role
636 636

  
637 637
      group_class = anonymous? ? GroupAnonymous : GroupNonMember
638
      group_id = group_class.pluck(:id).first
638
      group_id = group_class.pick(:id)
639 639

  
640 640
      members = Member.joins(:project, :member_roles).
641 641
        where("#{Project.table_name}.status <> 9").
lib/redmine/nested_set/issue_nested_set.rb (working copy)
139 139
      end
140 140

  
141 141
      def reload_nested_set_values
142
        self.root_id, self.lft, self.rgt = self.class.where(:id => id).pluck(:root_id, :lft, :rgt).first
142
        self.root_id, self.lft, self.rgt = self.class.where(:id => id).pick(:root_id, :lft, :rgt)
143 143
      end
144 144

  
145 145
      def save_nested_set_values
lib/redmine/nested_set/project_nested_set.rb (working copy)
39 39
        if siblings_rgt
40 40
          siblings_rgt + 1
41 41
        elsif parent_id
42
          parent_lft = self.class.where(:id => parent_id).pluck(:lft).first
42
          parent_lft = self.class.where(:id => parent_id).pick(:lft)
43 43
          raise "Project id=#{id} with parent_id=#{parent_id}: parent missing or without 'lft' value" unless parent_lft
44 44
          parent_lft + 1
45 45
        else
......
108 108
      end
109 109

  
110 110
      def reload_nested_set_values
111
        self.lft, self.rgt = Project.where(:id => id).pluck(:lft, :rgt).first
111
        self.lft, self.rgt = Project.where(:id => id).pick(:lft, :rgt)
112 112
      end
113 113

  
114 114
      def save_nested_set_values
(1-1/3)