From c23f126f1fa233c8bccddb7e4e113a20610e4252 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 15 Mar 2017 18:14:58 +0000 Subject: Fix link to issues when displaying a project query (#1565). git-svn-id: http://svn.redmine.org/redmine/trunk@16409 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/query.rb | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'app/models') diff --git a/app/models/query.rb b/app/models/query.rb index 23eca0278..a0f1969e3 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -387,19 +387,23 @@ class Query < ActiveRecord::Base end def as_params - params = {} - filters.each do |field, options| - params[:f] ||= [] - params[:f] << field - params[:op] ||= {} - params[:op][field] = options[:operator] - params[:v] ||= {} - params[:v][field] = options[:values] + if new_record? + params = {} + filters.each do |field, options| + params[:f] ||= [] + params[:f] << field + params[:op] ||= {} + params[:op][field] = options[:operator] + params[:v] ||= {} + params[:v][field] = options[:values] + end + params[:c] = column_names + params[:sort] = sort_criteria.to_param + params[:set_filter] = 1 + params + else + {:query_id => id} end - params[:c] = column_names - params[:sort] = sort_criteria.to_param - params[:set_filter] = 1 - params end def validate_query_filters -- cgit v1.2.3