diff options
-rw-r--r-- | app/models/issue_query.rb | 1 | ||||
-rw-r--r-- | test/unit/query_test.rb | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 668941bdd..c8336078a 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -221,6 +221,7 @@ class IssueQuery < Query end disabled_fields = Tracker.disabled_core_fields(trackers).map {|field| field.sub(/_id$/, '')} + disabled_fields << "total_estimated_hours" if disabled_fields.include?("estimated_hours") @available_columns.reject! {|column| disabled_fields.include?(column.name.to_s) } diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 0b0de108c..ac2b4a00e 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -1952,6 +1952,25 @@ class QueryTest < ActiveSupport::TestCase end end + def test_available_columns_should_not_include_total_estimated_hours_when_trackers_disabled_estimated_hours + Tracker.visible.each do |tracker| + tracker.core_fields = tracker.core_fields.reject{|field| field == 'estimated_hours'} + tracker.save! + end + query = IssueQuery.new + available_columns = query.available_columns.map(&:name) + assert_not_include :estimated_hours, available_columns + assert_not_include :total_estimated_hours, available_columns + + tracker = Tracker.visible.first + tracker.core_fields = ['estimated_hours'] + tracker.save! + query = IssueQuery.new + available_columns = query.available_columns.map(&:name) + assert_include :estimated_hours, available_columns + assert_include :total_estimated_hours, available_columns + end + def setup_member_of_group Group.destroy_all # No fixtures @user_in_group = User.generate! |