[#5482] Fix counts when grouping by contracts in the issues list
This commit is contained in:
@@ -92,8 +92,12 @@ Dispatcher.to_prepare :redmine_contracts do
|
||||
Query.add_available_column(QueryColumn.new(:deliverable, :sortable => "#{Deliverable.table_name}.title", :groupable => 'deliverable'))
|
||||
end
|
||||
|
||||
# Hack in order to get the associated contract to be grouped by name
|
||||
# * Proxy method Issue#contract_name
|
||||
# * Naming Query column contract_name
|
||||
# * Grouping by 'contracts.name'
|
||||
unless Query.available_columns.collect(&:name).include?(:contract_name)
|
||||
Query.add_available_column(QueryColumn.new(:contract_name, :sortable => "#{Contract.table_name}.name", :groupable => 'contract_id'))
|
||||
Query.add_available_column(QueryColumn.new(:contract_name, :sortable => "#{Contract.table_name}.name", :groupable => 'contracts.name'))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@ module RedmineContracts
|
||||
belongs_to :deliverable
|
||||
|
||||
delegate :title, :to => :deliverable, :prefix => true, :allow_nil => true
|
||||
delegate :contract_name, :to => :deliverable, :allow_nil => true
|
||||
delegate :contract, :to => :deliverable, :allow_nil => true
|
||||
|
||||
def contract_name
|
||||
contract.try(:name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class IssueFilteringTest < ActionController::IntegrationTest
|
||||
assert_select "span.count", "(1)"
|
||||
end
|
||||
assert_select "td", :text => Regexp.new(@contract.name) do
|
||||
assert_select "span.count", "()"
|
||||
assert_select "span.count", "(1)"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user