Project

General

Profile

Defect #33290 » 0001-stop-db-access-on-class-definition.patch

Kevin Fischer, 2020-04-15 10:44

View differences:

app/models/query.rb
28 28
    self.name = name
29 29
    self.sortable = options[:sortable]
30 30
    self.groupable = options[:groupable] || false
31
    if groupable == true
32
      self.groupable = name.to_s
33
    end
34 31
    self.totalable = options[:totalable] || false
35 32
    self.default_order = options[:default_order]
36 33
    @inline = options.key?(:inline) ? options[:inline] : true
......
82 79
  def css_classes
83 80
    name
84 81
  end
82

  
83
  def group_by_statement
84
    name.to_s
85
  end
85 86
end
86 87
class TimestampQueryColumn < QueryColumn
87
  def groupable
88
    if @groupable
89
      Redmine::Database.timestamp_to_date(sortable, User.current.time_zone)
90
    end
88
  def group_by_statement
89
    Redmine::Database.timestamp_to_date(sortable, User.current.time_zone)
91 90
  end
92 91
  def group_value(object)
......
127 126
    @cf = custom_field
128 127
  end
128
  def group_by_statement
129
    @cf.group_statement
130
  end
131

  
129 132
  def caption
130 133
    @cf.name
131 134
  end
......
869 872
  end
870 873
  def group_by_statement
871
    group_by_column.try(:groupable)
874
    group_by_column.try(:group_by_statement)
872 875
  end
873 876
  def project_statement
(1-1/2)