Defect #36248

Time entries of sub-projects are not listed when activity is specified in filters

Added by Yuichi HARADA 9 months ago. Updated 6 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Marius BALTEANU% Done:

0%

Category:Time tracking
Target version:4.2.4
Resolution:Fixed Affected version:

Description

If the activity of the parent project is not a system activity, the time entries of the sub-projects are not displayed when the Activity filter is specified in the spent time list of the parent project.

Activity setting of parent project

When the Activity filter is not used

When using the Activity filter

settings-time-tracking.png (124 KB) Yuichi HARADA, 2021-11-26 05:38

spent-time-list-without-activity-fillter.png (215 KB) Yuichi HARADA, 2021-11-26 05:49

spent-time-list-with-activity-fillter.png (115 KB) Yuichi HARADA, 2021-11-26 05:50

36248.patch Magnifier (1.87 KB) Yuichi HARADA, 2021-11-30 04:11

Associated revisions

Revision 21423
Added by Marius BALTEANU 6 months ago

Fix time entries of sub-projects are not listed when activity is specified in filters (#36248).

Patch by Yuichi HARADA.

Revision 21425
Added by Marius BALTEANU 6 months ago

Merged r21423 to 4.2-stable (#36248).

Revision 21426
Added by Marius BALTEANU 6 months ago

Merged r21423 to 4.1-stable (#36248).

History

#1 Updated by Yuichi HARADA 9 months ago

I think the following patch can solve it.

diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 11128cfcd6..5fd4790893 100644
--- a/app/models/time_entry_query.rb
+++ b/app/models/time_entry_query.rb
@@ -88,7 +88,7 @@ class TimeEntryQuery < Query
     activities = (project ? project.activities : TimeEntryActivity.shared)
     add_available_filter(
       "activity_id",
-      :type => :list, :values => activities.map {|a| [a.name, a.id.to_s]}
+      :type => :list, :values => activities.map {|a| [a.name, (a.parent_id || a.id).to_s]}
     )
     add_available_filter(
       "project.status",

#2 Updated by Yuichi HARADA 8 months ago

I created a test. I have attached a patch containing #note-1.

#3 Updated by Go MAEDA 8 months ago

  • Status changed from New to Confirmed

#4 Updated by Go MAEDA 8 months ago

  • Target version set to 4.2.4

Setting the target version to 4.2.4.

#5 Updated by Marius BALTEANU 6 months ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Marius BALTEANU
  • Resolution set to Fixed

Patch committed, thanks!

#6 Updated by Marius BALTEANU 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF