https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292018-11-22T10:32:13ZRedmineRedmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=884792018-11-22T10:32:13ZGo MAEDA
<ul><li><strong>Category</strong> set to <i>Issues</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li></ul><p>I could not reproduce the problem. Can you see any error regarding this problem in log/production.log ?</p> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=884802018-11-22T10:55:45ZKumar Abhinav
<ul></ul><p>It is reproducible on a clean install of Redmine 3.4.6.<br />After you save the query,make sure the same query is loaded & click apply.</p>
<p>Since the middle criteria for sort is left empty,the to_param method in Redmine::SortCriteria throws "undefined method `+' for nil:NilClass" error.</p> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=884812018-11-22T16:15:05ZBernhard Rohloff
<ul></ul><p>I can confirm the defect. It also occurs on the latest trunk.<br />Switching the query works as expected. As Kumar wrote it only occurs after applying the query a second time.</p> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=884822018-11-23T05:25:31ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Needs feedback</i> to <i>Confirmed</i></li></ul><p>Kumar Abhinav wrote:</p>
<blockquote>
<p>After you save the query,make sure the same query is loaded & click apply.</p>
</blockquote>
<p>Yes, I didn't click "Apply" after creating the query. Now I can reproduce the problem.</p> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=885192018-11-25T20:42:20ZMarius BÄ‚LTEANU
<ul><li><strong>File</strong> <a href="/attachments/21878">0001-Remove-blank-keys-from-sort-criterias.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/21878/0001-Remove-blank-keys-from-sort-criterias.patch">0001-Remove-blank-keys-from-sort-criterias.patch</a> added</li><li><strong>Target version</strong> set to <i>Candidate for next minor release</i></li></ul><p>Attached a patch that fixes this problem by removing the blank keys from sort criteria.</p>
<p>Another fix is the below one, but I prefer the first solution.<br /><pre><code class="diff syntaxhl"><span class="gh">diff --git a/lib/redmine/sort_criteria.rb b/lib/redmine/sort_criteria.rb
index c89ef03c1..acfcbdb0f 100644
</span><span class="gd">--- a/lib/redmine/sort_criteria.rb
</span><span class="gi">+++ b/lib/redmine/sort_criteria.rb
</span><span class="p">@@ -32,7 +32,7 @@</span> module Redmine
end
def to_param
<span class="gd">- self.collect {|k,o| k + (o == 'desc' ? ':desc' : '')}.join(',')
</span><span class="gi">+ self.collect {|k,o| k + (o == 'desc' ? ':desc' : '') unless k.nil? }.join(',')
</span> end
def to_a
</code></pre></p>
<p>Also, maybe it is a good idea to fix this issue also in the UI by not allowing to select a third sort criteria without selecting the second.</p> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=885202018-11-25T20:43:18ZMarius BÄ‚LTEANU
<ul><li><strong>Subject</strong> changed from <i>empty sort criteria for issue query gives error</i> to <i>Empty sort criteria for issue query gives error</i></li></ul> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=885332018-11-26T05:01:40ZGo MAEDA
<ul><li><strong>Target version</strong> changed from <i>Candidate for next minor release</i> to <i>3.4.7</i></li></ul> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=885352018-11-26T05:24:41ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Confirmed</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=885362018-11-26T05:46:26ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul><p>Committed the patch. Thank you for the patch.</p> Redmine - Defect #30009: Empty sort criteria for issue query gives errorhttps://www.redmine.org/issues/30009?journal_id=959072020-01-27T12:00:24ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/32737">Defect #32737</a>: Duplicate sort keys for issue query cause SQL error with SQL Server</i> added</li></ul>