プロジェクト

全般

プロフィール

Vote #81150

完了

Subprojects issues are not displayed on main project when all subprojects are closed

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues list_58
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
58
version_id:
161
issue_org_id:
34297
author_id:
484688
assigned_to_id:
332
comments:
11
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
160
ステータス-->[Closed]

説明

No issues are displayed on issue page

parent project (open)
  - subproject1 (closed)
  - subproject2 (closed)

It shows sub1, sub2 issues.

parent project (open)
  - subproject1 (closed)
  - subproject2 (open)

journals

I have confirmed the reported behavior. If there are one or more open subprojects, issues in closed subprojects are visible in a parent project's issues list. However, if all subprojects are closed, all issues from subprojects are invisible.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Go MAEDA wrote:
> I have confirmed the reported behavior. If there are one or more open subprojects, issues in closed subprojects are visible in a parent project's issues list. However, if all subprojects are closed, all issues from subprojects are invisible.

I created a patch. I fix to show subprojects issues even if all subprojects are closed.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Yuichi HARADA wrote:
> I created a patch. I fix to show subprojects issues even if all subprojects are closed.

Thank you for posting the patch.

What do you think about the following approach? The number of lines to be changed is minimal, and also fixes #34375.

<pre><code class="diff">
diff --git a/app/models/query.rb b/app/models/query.rb
index 18f1b135b..8ed09579d 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 = []
+ non_archived_subprojects_ids = []

- active_subprojects_ids = project.descendants.active.map(&:id) if project
- if active_subprojects_ids.any?
+ non_archived_subprojects_ids = project.descendants.where.not(status: Project::STATUS_ARCHIVED).ids if project
+ if non_archived_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] + non_archived_subprojects_ids - values_for("subproject_id").map(&:to_i)
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
when '!*'
# main project only
</code></pre>
--------------------------------------------------------------------------------
Go MAEDA wrote:
> What do you think about the following approach? The number of lines to be changed is minimal, and also fixes #34375.
>
>
> [...]

That's great. I have confirmed that #34375 is also improved with minimal changes.
--------------------------------------------------------------------------------
Yuichi HARADA wrote:
> Go MAEDA wrote:
> > What do you think about the following approach? The number of lines to be changed is minimal, and also fixes #34375.
> >
> >
> > [...]
>
> That's great. I have confirmed that #34375 is also improved with minimal changes.

Thank you for checking the code. I have updated the patch:

* Combined the code in #34297#note-6 and tests in attachment:fixed-34297.patch
* Simplified tests
--------------------------------------------------------------------------------
Setting the target version to 4.0.8.
--------------------------------------------------------------------------------
Committed the patch.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,34375,"is not" operator for Subproject filter incorrectly excludes closed subprojects

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0