From: Jean-Philippe Lang Date: Sat, 1 Oct 2016 08:53:31 +0000 (+0000) Subject: Error with MS SQL when displaying an issue from a list grouped and sorted by fixed... X-Git-Tag: 3.4.0~679 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1810283a6684cbc8c7ce55ccfb9c4a58dbc312a9;p=redmine.git Error with MS SQL when displaying an issue from a list grouped and sorted by fixed version (#23839). git-svn-id: http://svn.redmine.org/redmine/trunk@15852 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/query.rb b/app/models/query.rb index fdfe8ec7e..ef2efc735 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -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 diff --git a/test/integration/issues_test.rb b/test/integration/issues_test.rb index 2e8587d5a..86c0db68a 100644 --- a/test/integration/issues_test.rb +++ b/test/integration/issues_test.rb @@ -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'