]> source.dussan.org Git - redmine.git/commitdiff
Malformed SQL query with SQLServer when grouping and sorting by fixed version (#22808).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 16 May 2016 07:03:14 +0000 (07:03 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 16 May 2016 07:03:14 +0000 (07:03 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15416 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/functional/issues_controller_test.rb

index d1315d5dee1837b521110b78c9506ada7a270a59..a9d24ad3070e26dc991274034ced6e912433767b 100644 (file)
@@ -546,7 +546,7 @@ class Query < ActiveRecord::Base
     if grouped? && (column = group_by_column)
       order = (sort_criteria_order_for(column.name) || column.default_order).try(:upcase)
       column.sortable.is_a?(Array) ?
-        column.sortable.collect {|s| "#{s} #{order}"}.join(',') :
+        column.sortable.collect {|s| "#{s} #{order}"} :
         "#{column.sortable} #{order}"
     end
   end
index 8e04d7cf5353a2c4f2fbe221bdb07a14e3e781ef..32f9d8f11c60e9048ccb370702b197b6a6a1d4db 100644 (file)
@@ -273,6 +273,22 @@ class IssuesControllerTest < ActionController::TestCase
     assert_not_nil assigns(:issue_count_by_group)
   end
 
+  def test_index_with_query_grouped_and_sorted_by_fixed_version
+    get :index, :project_id => 1, :set_filter => 1, :group_by => "fixed_version", :sort => "fixed_version"
+    assert_response :success
+    assert_template 'index'
+    assert_not_nil assigns(:issues)
+    assert_not_nil assigns(:issue_count_by_group)
+  end
+
+  def test_index_with_query_grouped_and_sorted_by_fixed_version_in_reverse_order
+    get :index, :project_id => 1, :set_filter => 1, :group_by => "fixed_version", :sort => "fixed_version:desc"
+    assert_response :success
+    assert_template 'index'
+    assert_not_nil assigns(:issues)
+    assert_not_nil assigns(:issue_count_by_group)
+  end
+
   def test_index_with_query_grouped_by_list_custom_field
     get :index, :project_id => 1, :query_id => 9
     assert_response :success