end
def find_issues_with_query(query)
- Issue.find :all,
- :include => [ :assigned_to, :status, :tracker, :project, :priority ],
- :conditions => query.statement
+ Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where(
+ query.statement
+ ).all
end
def assert_find_issues_with_query_is_successful(query)
c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' }
assert c
assert c.sortable
- issues = Issue.find :all,
- :include => [ :assigned_to, :status, :tracker, :project, :priority ],
- :conditions => q.statement,
- :order => "#{c.sortable} ASC"
+ issues = Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where(
+ q.statement
+ ).order("#{c.sortable} ASC").all
values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s}
assert !values.empty?
assert_equal values.sort, values
c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' }
assert c
assert c.sortable
- issues = Issue.find :all,
- :include => [ :assigned_to, :status, :tracker, :project, :priority ],
- :conditions => q.statement,
- :order => "#{c.sortable} DESC"
+ issues = Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where(
+ q.statement
+ ).order("#{c.sortable} DESC").all
values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s}
assert !values.empty?
assert_equal values.sort.reverse, values
c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'float' }
assert c
assert c.sortable
- issues = Issue.find :all,
- :include => [ :assigned_to, :status, :tracker, :project, :priority ],
- :conditions => q.statement,
- :order => "#{c.sortable} ASC"
+ issues = Issue.includes([:assigned_to, :status, :tracker, :project, :priority]).where(
+ q.statement
+ ).order("#{c.sortable} ASC").all
values = issues.collect {|i| begin; Kernel.Float(i.custom_value_for(c.custom_field).to_s); rescue; nil; end}.compact
assert !values.empty?
assert_equal values.sort, values