diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-11-08 14:54:00 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-11-08 14:54:00 +0000 |
commit | 95401eced1ce7073d2a4398c9f3cb289d98d796f (patch) | |
tree | 456141eaf5d34db78caf18854cdef8fbc5c3bf89 /app | |
parent | b5dbe41e781869cff5aac0a3474e0a04d48b2386 (diff) | |
download | redmine-95401eced1ce7073d2a4398c9f3cb289d98d796f.tar.gz redmine-95401eced1ce7073d2a4398c9f3cb289d98d796f.zip |
cleanup: rubocop: fix Layout/AlignArguments in app/models/query.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18967 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/query.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index dafc51fdd..5daf36e84 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -341,15 +341,16 @@ class Query < ActiveRecord::Base if user.admin? scope.where("#{table_name}.visibility <> ? OR #{table_name}.user_id = ?", VISIBILITY_PRIVATE, user.id) elsif user.memberships.any? - scope.where("#{table_name}.visibility = ?" + - " OR (#{table_name}.visibility = ? AND #{table_name}.id IN (" + + scope.where( + "#{table_name}.visibility = ?" + + " OR (#{table_name}.visibility = ? AND #{table_name}.id IN (" + "SELECT DISTINCT q.id FROM #{table_name} q" + " INNER JOIN #{table_name_prefix}queries_roles#{table_name_suffix} qr on qr.query_id = q.id" + " INNER JOIN #{MemberRole.table_name} mr ON mr.role_id = qr.role_id" + " INNER JOIN #{Member.table_name} m ON m.id = mr.member_id AND m.user_id = ?" + " INNER JOIN #{Project.table_name} p ON p.id = m.project_id AND p.status <> ?" + " WHERE q.project_id IS NULL OR q.project_id = m.project_id))" + - " OR #{table_name}.user_id = ?", + " OR #{table_name}.user_id = ?", VISIBILITY_PUBLIC, VISIBILITY_ROLES, user.id, Project::STATUS_ARCHIVED, user.id) elsif user.logged? scope.where("#{table_name}.visibility = ? OR #{table_name}.user_id = ?", VISIBILITY_PUBLIC, user.id) @@ -1309,8 +1310,9 @@ class Query < ActiveRecord::Base prefix = '%' if options[:ends_with] suffix = '%' if options[:starts_with] prefix = suffix = '%' if prefix.nil? && suffix.nil? - queried_class.send :sanitize_sql_for_conditions, - [Redmine::Database.like(db_field, '?', :match => options[:match]), "#{prefix}#{value}#{suffix}"] + queried_class.send( + :sanitize_sql_for_conditions, + [Redmine::Database.like(db_field, '?', :match => options[:match]), "#{prefix}#{value}#{suffix}"]) end # Adds a filter for the given custom field @@ -1356,18 +1358,18 @@ class Query < ActiveRecord::Base add_custom_field_filter(field, assoc) if assoc.nil? add_chained_custom_field_filters(field) - if field.format.target_class && field.format.target_class == Version - add_available_filter "cf_#{field.id}.due_date", + add_available_filter( + "cf_#{field.id}.due_date", :type => :date, :field => field, - :name => l(:label_attribute_of_object, :name => l(:field_effective_date), :object_name => field.name) - - add_available_filter "cf_#{field.id}.status", + :name => l(:label_attribute_of_object, :name => l(:field_effective_date), :object_name => field.name)) + add_available_filter( + "cf_#{field.id}.status", :type => :list, :field => field, :name => l(:label_attribute_of_object, :name => l(:field_status), :object_name => field.name), - :values => Version::VERSION_STATUSES.map{|s| [l("version_status_#{s}"), s] } + :values => Version::VERSION_STATUSES.map{|s| [l("version_status_#{s}"), s]}) end end end |