Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

use sql_for_field of operator_strategy instead of custom SQL

Ivan Kuchinea5206a97f2c
diff --git a/app/models/queries/work_packages/filter/project_phase_filter.rb b/app/models/queries/work_packages/filter/project_phase_filter.rb
index b5d8879c061..96a9c87b99a 100644
--- a/app/models/queries/work_packages/filter/project_phase_filter.rb
+++ b/app/models/queries/work_packages/filter/project_phase_filter.rb
@@ -62,21 +62,7 @@ class Queries::WorkPackages::Filter::ProjectPhaseFilter < Queries::WorkPackages:
end
def where
- placeholders = values.map { "?" }.join(",")
-
- sql = if operator_strategy.to_sym == :"="
- <<~SQL.squish
- active_phases.active_phase_definition_id IS NOT NULL AND
- active_phases.active_phase_definition_id IN (#{placeholders})
- SQL
- else
- <<~SQL.squish
- active_phases.active_phase_definition_id IS NULL OR
- active_phases.active_phase_definition_id NOT IN (#{placeholders})
- SQL
- end
-
- ActiveRecord::Base.sanitize_sql_array([sql, *values])
+ operator_strategy.sql_for_field(values, :active_phases, :active_phase_definition_id)
end
private