summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-01-19 13:33:11 +0000
committerGo MAEDA <maeda@farend.jp>2022-01-19 13:33:11 +0000
commitf2ae2b9936b3221036e7563b314c13438794615b (patch)
treebc2b881a4bc3aa8420b22fadfbceb6615826cf52
parent2f8e4231d06b832d2fc16bfc53fa18055ebeca07 (diff)
downloadredmine-f2ae2b9936b3221036e7563b314c13438794615b.tar.gz
redmine-f2ae2b9936b3221036e7563b314c13438794615b.zip
Duplicate activities in time entry report when project-specific activies exist (#20018).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21371 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--lib/redmine/helpers/time_report.rb2
-rw-r--r--test/functional/timelog_report_test.rb13
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/redmine/helpers/time_report.rb b/lib/redmine/helpers/time_report.rb
index cac5f2427..2ae5fd8eb 100644
--- a/lib/redmine/helpers/time_report.rb
+++ b/lib/redmine/helpers/time_report.rb
@@ -122,7 +122,7 @@ module Redmine
'tracker' => {:sql => "#{Issue.table_name}.tracker_id",
:klass => Tracker,
:label => :label_tracker},
- 'activity' => {:sql => "#{TimeEntry.table_name}.activity_id",
+ 'activity' => {:sql => "COALESCE(#{TimeEntryActivity.table_name}.parent_id, #{TimeEntryActivity.table_name}.id)",
:klass => TimeEntryActivity,
:label => :field_activity},
'issue' => {:sql => "#{TimeEntry.table_name}.issue_id",
diff --git a/test/functional/timelog_report_test.rb b/test/functional/timelog_report_test.rb
index a3c085db2..d72491418 100644
--- a/test/functional/timelog_report_test.rb
+++ b/test/functional/timelog_report_test.rb
@@ -224,6 +224,19 @@ class TimelogReportTest < Redmine::ControllerTest
assert_select 'td', :text => 'New'
end
+ def test_report_activity_criterion_should_aggregate_system_activity_and_project_activity
+ activity = TimeEntryActivity.create!(:name => 'Design', :parent_id => 9, :project_id => 3)
+ TimeEntry.generate!(:project_id => 3, :issue_id => 5, :activity_id => activity.id, :spent_on => '2007-05-23', :hours => 10.0)
+
+ get :report, :params => {:project_id => 1, :criteria => ['activity']}
+ assert_response :success
+
+ assert_select 'tr.last-level:first' do
+ assert_select 'td.name', :text => 'Design'
+ assert_select 'td.hours:last', :text => '165:15'
+ end
+ end
+
def test_report_all_projects_csv_export
get :report, :params => {
:columns => 'month',