]> source.dussan.org Git - redmine.git/commitdiff
Error with MS SQL when displaying an issue from a list grouped and sorted by fixed...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 1 Oct 2016 08:53:31 +0000 (08:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 1 Oct 2016 08:53:31 +0000 (08:53 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15852 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/integration/issues_test.rb

index fdfe8ec7e671a3f0f339267c3f8d7d4ff96e51db..ef2efc735f0cc829a8b90439323f7adef32c925b 100644 (file)
@@ -640,7 +640,7 @@ class Query < ActiveRecord::Base
   # Returns the SQL sort order that should be prepended for grouping
   def group_by_sort_order
     if column = group_by_column
-      order = (sort_criteria_order_for(column.name) || column.default_order).try(:upcase)
+      order = (sort_criteria_order_for(column.name) || column.default_order || 'asc').try(:upcase)
       Array(column.sortable).map {|s| "#{s} #{order}"}
     end
   end
index 2e8587d5a656c799ec42c1ba7f654358de83de53..86c0db68a48adf3942f4d4d45d3dbcbb6627e960 100644 (file)
@@ -109,6 +109,18 @@ class IssuesTest < Redmine::IntegrationTest
     assert_equal 0, Issue.find(1).attachments.length
   end
 
+  def test_next_and_previous_links_should_be_displayed_after_query_grouped_and_sorted_by_version
+    with_settings :default_language => 'en' do
+      get '/projects/ecookbook/issues?set_filter=1&group_by=fixed_version&sort=priority:desc,fixed_version'
+      assert_response :success
+      assert_select 'td.id', :text => '5'
+  
+      get '/issues/5'
+      assert_response :success
+      assert_select '.next-prev-links .position', :text => '5 of 6'
+    end
+  end
+
   def test_next_and_previous_links_should_be_displayed_after_filter
     with_settings :default_language => 'en' do
       get '/projects/ecookbook/issues?set_filter=1&tracker_id=1'