Patch #33728

Remove an unused variable in Query#add_chained_custom_field_filters

Added by Mizuki ISHIKAWA 4 months ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.2.0

Description

It's a very small change that remove unused variable.

diff --git a/app/models/query.rb b/app/models/query.rb
index 61c47bdda..77004dbb5 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -1378,7 +1378,6 @@ class Query < ActiveRecord::Base
         options = chained.query_filter_options(self)

         filter_id = "cf_#{field.id}.cf_#{chained.id}" 
-        filter_name = chained.name

         add_available_filter filter_id, options.merge({
           :name => l(:label_attribute_of_object, :name => chained.name, :object_name => field.name),

Associated revisions

Revision 20007
Added by Go MAEDA about 1 month ago

Remove an unused variable in Query#add_chained_custom_field_filters (#33728).

Patch by Mizuki ISHIKAWA.

History

#1 Updated by Go MAEDA 3 months ago

Thank you for reporting the issue. I prefer the following fix because filter_id and filter_name are used as a pair at another line in query.rb (source:tags/4.1.1/app/models/query.rb#L1328).

diff --git a/app/models/query.rb b/app/models/query.rb
index 6da317514..c41f64cd5 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -1390,7 +1390,7 @@ class Query < ActiveRecord::Base
           options.merge(
             {
               :name => l(:label_attribute_of_object,
-                         :name => chained.name,
+                         :name => filter_name,
                          :object_name => field.name),
               :field => chained,
               :through => field

#2 Updated by Mizuki ISHIKAWA 3 months ago

Go MAEDA wrote:

Thank you for reporting the issue. I prefer the following fix because filter_id and filter_name are used as a pair at another line in query.rb (source:tags/4.1.1/app/models/query.rb#L1328).

OK, I think either solution is fine.

#3 Updated by Go MAEDA 3 months ago

  • Target version set to Candidate for next major release

#4 Updated by Go MAEDA 3 months ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#5 Updated by Go MAEDA about 1 month ago

  • Subject changed from Remove unused variable Query#filter_name to Remove an unused variable in Query#add_chained_custom_field_filters
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch. Thank you.

Also available in: Atom PDF