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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#36743] working, hardcoded implementation
Tobias Dillmann4fb5f1791b92
diff --git a/app/models/queries/work_packages/filter/ancestor_filter.rb b/app/models/queries/work_packages/filter/ancestor_filter.rbindex 786cda045de..5118a4a9ef1 100644--- a/app/models/queries/work_packages/filter/ancestor_filter.rb+++ b/app/models/queries/work_packages/filter/ancestor_filter.rb@@ -39,9 +39,28 @@ class Queries::WorkPackages::Filter::AncestorFilter <Relation::TYPE_PARENTend+ def apply_to(_query_scope)+ cte = <<~SQL.squish+ WITH RECURSIVE descendants AS (+ SELECT id+ FROM work_packages+ WHERE id IN (:ids)+ UNION ALL+ SELECT wp.id+ FROM work_packages wp+ INNER JOIN descendants d ON wp.parent_id = d.id+ )+ SELECT * FROM descendants;+ SQL++ sql = ActiveRecord::Base.sanitize_sql([cte, { ids: no_templated_values }])++ descendants = super.find_by_sql(sql)++ WorkPackage.where(id: descendants.pluck(:id))+ end+def where- # The filter had been called parent before and it is stored in the database like that.- # The other association filters all have _id in their self.key.- operator_strategy.sql_for_field(no_templated_values, self.class.model.table_name, :parent_id)+ "1 = 1"endend