Renames query column attribute 'alias' to 'join'

pull/724/head
Hagen Schink 11 years ago
parent d9b370800b
commit ca36cbb311
  1. 2
      app/models/query.rb
  2. 2
      app/models/query/results.rb
  3. 4
      app/models/query_column.rb

@ -89,7 +89,7 @@ class Query < ActiveRecord::Base
QueryColumn.new(:subject, :sortable => "#{WorkPackage.table_name}.subject"),
QueryColumn.new(:author),
QueryColumn.new(:assigned_to, :sortable => ["#{User.table_name}.lastname", "#{User.table_name}.firstname", "#{User.table_name}.id"], :groupable => true),
QueryColumn.new(:responsible, sortable: ["responsible.lastname", "responsible.firstname", "responsible.id"], groupable: "#{WorkPackage.table_name}.responsible_id", :alias => 'LEFT OUTER JOIN users as responsible ON (work_packages.responsible_id = responsible.id)'),
QueryColumn.new(:responsible, sortable: ["responsible.lastname", "responsible.firstname", "responsible.id"], groupable: "#{WorkPackage.table_name}.responsible_id", :join => 'LEFT OUTER JOIN users as responsible ON (work_packages.responsible_id = responsible.id)'),
QueryColumn.new(:updated_at, :sortable => "#{WorkPackage.table_name}.updated_at", :default_order => 'desc'),
QueryColumn.new(:category, :sortable => "#{Category.table_name}.name", :groupable => true),
QueryColumn.new(:fixed_version, :sortable => ["#{Version.table_name}.effective_date", "#{Version.table_name}.name"], :default_order => 'desc', :groupable => true),

@ -80,7 +80,7 @@ class ::Query::Results
WorkPackage.where(::Query.merge_conditions(query.statement, options[:conditions]))
.includes([:status, :project] + (options[:include] || []).uniq)
.joins((query.group_by_column ? query.group_by_column.alias : nil))
.joins((query.group_by_column ? query.group_by_column.join : nil))
.order(order_option)
end

@ -27,7 +27,7 @@
#++
class QueryColumn
attr_accessor :name, :sortable, :groupable, :alias, :default_order
attr_accessor :name, :sortable, :groupable, :join, :default_order
include Redmine::I18n
def initialize(name, options={})
@ -39,7 +39,7 @@ class QueryColumn
else
groupable || false
end
self.alias = options.delete(:alias)
self.join = options.delete(:join)
self.default_order = options[:default_order]
@caption_key = options[:caption] || name.to_s

Loading…
Cancel
Save