summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-12-27 06:46:37 +0000
committerGo MAEDA <maeda@farend.jp>2020-12-27 06:46:37 +0000
commit36b5c3204891aa63ff24cf6da434170cdcfdad5e (patch)
treeb30757a0dec986c15933f8c9b29d5afa1f0d8715 /app/models/query.rb
parent972f00eb473ffd07292bb0960428c0181046b613 (diff)
downloadredmine-36b5c3204891aa63ff24cf6da434170cdcfdad5e.tar.gz
redmine-36b5c3204891aa63ff24cf6da434170cdcfdad5e.zip
Subprojects issues are not displayed on main project when all subprojects are closed (#34297).
Patch by Yuichi HARADA and Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@20693 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 18f1b135b..039e38e32 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -898,10 +898,10 @@ class Query < ActiveRecord::Base
def project_statement
project_clauses = []
- active_subprojects_ids = []
+ subprojects_ids = []
- active_subprojects_ids = project.descendants.active.map(&:id) if project
- if active_subprojects_ids.any?
+ subprojects_ids = project.descendants.where.not(status: Project::STATUS_ARCHIVED).ids if project
+ if subprojects_ids.any?
if has_filter?("subproject_id")
case operator_for("subproject_id")
when '='
@@ -910,7 +910,7 @@ class Query < ActiveRecord::Base
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
when '!'
# exclude the selected subprojects
- ids = [project.id] + active_subprojects_ids - values_for("subproject_id").map(&:to_i)
+ ids = [project.id] + subprojects_ids - values_for("subproject_id").map(&:to_i)
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
when '!*'
# main project only