@@ -323,7 +323,7 class IssueQuery < Query | |||||
323 | def issues(options={}) |
|
323 | def issues(options={}) | |
324 | order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?) |
|
324 | order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?) | |
325 |
|
325 | |||
326 |
|
|
326 | scope = Issue.visible. | |
327 | joins(:status, :project). |
|
327 | joins(:status, :project). | |
328 | where(statement). |
|
328 | where(statement). | |
329 | includes(([:status, :project] + (options[:include] || [])).uniq). |
|
329 | includes(([:status, :project] + (options[:include] || [])).uniq). | |
@@ -331,8 +331,13 class IssueQuery < Query | |||||
331 | order(order_option). |
|
331 | order(order_option). | |
332 | joins(joins_for_order_statement(order_option.join(','))). |
|
332 | joins(joins_for_order_statement(order_option.join(','))). | |
333 | limit(options[:limit]). |
|
333 | limit(options[:limit]). | |
334 |
offset(options[:offset]) |
|
334 | offset(options[:offset]) | |
335 | all |
|
335 | ||
|
336 | if has_custom_field_column? | |||
|
337 | scope = scope.preload(:custom_values) | |||
|
338 | end | |||
|
339 | ||||
|
340 | issues = scope.all | |||
336 |
|
341 | |||
337 | if has_column?(:spent_hours) |
|
342 | if has_column?(:spent_hours) | |
338 | Issue.load_visible_spent_hours(issues) |
|
343 | Issue.load_visible_spent_hours(issues) |
@@ -449,6 +449,10 class Query < ActiveRecord::Base | |||||
449 | column_names && column_names.include?(column.is_a?(QueryColumn) ? column.name : column) |
|
449 | column_names && column_names.include?(column.is_a?(QueryColumn) ? column.name : column) | |
450 | end |
|
450 | end | |
451 |
|
451 | |||
|
452 | def has_custom_field_column? | |||
|
453 | columns.any? {|column| column.is_a? QueryCustomFieldColumn} | |||
|
454 | end | |||
|
455 | ||||
452 | def has_default_columns? |
|
456 | def has_default_columns? | |
453 | column_names.nil? || column_names.empty? |
|
457 | column_names.nil? || column_names.empty? | |
454 | end |
|
458 | end |
General Comments 0
You need to be logged in to leave comments.
Login now