Defect #20018
closedDuplicate activities in time entry report when project-specific activies exist
0%
Description
When using the report tool by Activity, it appears that some activities are repeated in the list, instead of being aggregated. The activities concerned are all used in several projects.
Example:
Observed:¶
Activity Total X 3 X 4 Y 5 Y 6 Z 7
Expected:¶
Activity Total X 7 Y 11 Z 7
If we apply the filter by projects, then by activities, there are no duplicates, everything works fine:
Project Activity Total 1 X 3 1 Y 5 2 X 4 2 Y 6 2 Z 7
Files
Related issues
Updated by Toshi MARUYAMA about 9 years ago
- Status changed from New to Needs feedback
Do you mean time time entry report?
And give us more information: Submissions.
Updated by Stephane Evr about 9 years ago
Yes, I mean the time entry report in general, not for a particular project.
Environment: Redmine version 3.0.1.stable.14155 Ruby version 2.2.1-p85 (2015-02-26) [x86_64-linux] Rails version 4.2.1 Environment production Database adapter Mysql2 SCM: Subversion 1.8.8 Git 1.9.1 Filesystem
here is an extract of my database for enumerations. I found several entries for the same name, which are linked to different projects:
mysql> select * from enumerations order by name; +-----+-------------------------------+----------+------------+-------------------+--------+------------+-----------+---------------+ | id | name | position | is_default | type | active | project_id | parent_id | position_name | +-----+-------------------------------+----------+------------+-------------------+--------+------------+-----------+---------------+ | 11 | Specification | 13 | 0 | TimeEntryActivity | 1 | NULL | NULL | NULL | | 22 | Specification | 11 | 0 | TimeEntryActivity | 0 | 7 | 11 | NULL | | 94 | Specification | 62 | 0 | TimeEntryActivity | 0 | 39 | 11 | NULL | | 123 | Specification | 85 | 0 | TimeEntryActivity | 0 | 38 | 11 | NULL | | 129 | Specification | 89 | 0 | TimeEntryActivity | 0 | 42 | 11 | NULL | | 165 | Specification | 119 | 0 | TimeEntryActivity | 0 | 43 | 11 | NULL | | 19 | Training | 10 | 0 | TimeEntryActivity | 1 | NULL | NULL | NULL | | 204 | Training | 150 | 0 | TimeEntryActivity | 0 | 54 | 19 | NULL | | 221 | Training | 166 | 0 | TimeEntryActivity | 0 | 53 | 19 | NULL | | 238 | Training | 182 | 0 | TimeEntryActivity | 0 | 55 | 19 | NULL |
Updated by Stephane Evr about 9 years ago
- File report_activities.PNG report_activities.PNG added
- File report_activities_projects.PNG report_activities_projects.PNG added
Here is what I get for an activity called "Other":
Now, If I add the "Projects" column (Each line is a different project):
Updated by Toshi MARUYAMA about 9 years ago
- Category set to Time tracking
- Status changed from Needs feedback to New
Updated by Toshi MARUYAMA over 8 years ago
Updated by Stephane Evr over 8 years ago
- File 1.PNG 1.PNG added
- File 2.PNG 2.PNG added
- File 4.PNG 4.PNG added
- File 3.PNG 3.PNG added
- File 5.PNG 5.PNG added
- File 6.PNG 6.PNG added
- File 7.PNG 7.PNG added
- File 8.PNG 8.PNG added
Toshi MARUYAMA wrote:
Is a consequence of this issue
See Submissions and give us what plugins you uses.
Could reproduce the bug as described on a freshly launched Bitnami redmine demo instance (https://bitnami.com/launch/redmine/aws/now):
Environment: Redmine version 3.2.1.stable Ruby version 2.1.8-p440 (2015-12-16) [x86_64-linux] Rails version 4.2.5.2 Environment production Database adapter Mysql2 SCM: Subversion 1.8.13 Cvs 1.12.13 Git 2.6.1 Filesystem Redmine plugins: no plugin installed
Steps to follow using a fresh redmine install:
Create a new activity, do not check "Active":
Create two projects "Test A" and "Test B". Don't need to set any specific param, appart from the "Activities (Time tracking)" tab. Do as follows for each project, then save:
Now that the activities are activated, time to log some time on each project:
and
Then click 1, then 2 on following:
Then click on the "Report" Button
Then click "Activity" in the Add section:
Result:
I hope these instructions are clear enough to be reproduced :)
Updated by Toshi MARUYAMA over 8 years ago
- Related to Defect #21056: Project specific TimeEntryActivity name not updating properly added
Updated by Toshi MARUYAMA over 8 years ago
- Subject changed from Duplicate activities in time entry report to Duplicate activities in time entry report of project specific TimeEntryActivity
- Status changed from New to Confirmed
- Affected version changed from 3.0.1 to 3.2.2
Updated by Toshi MARUYAMA over 8 years ago
mysql> select * from enumerations where name = "test0003"; +----+----------+----------+------------+-------------------+--------+------------+-----------+---------------+ | id | name | position | is_default | type | active | project_id | parent_id | position_name | +----+----------+----------+------------+-------------------+--------+------------+-----------+---------------+ | 33 | test0003 | 6 | 0 | TimeEntryActivity | 0 | NULL | NULL | NULL | | 41 | test0003 | 6 | 0 | TimeEntryActivity | 1 | 1 | 33 | NULL | | 45 | test0003 | 6 | 0 | TimeEntryActivity | 1 | 2 | 33 | NULL | +----+----------+----------+------------+-------------------+--------+------------+-----------+---------------+ 3 rows in set (0.00 sec)
Updated by Stephane Evr about 7 years ago
up
This still happens on Redmine 3.3.0.stable
Updated by Yuichi HARADA over 2 years ago
- File 20018.patch 20018.patch added
I also confirmed(trunk: r21299). I think the following patch will solve it.
diff --git a/lib/redmine/helpers/time_report.rb b/lib/redmine/helpers/time_report.rb
index 89b94ec3c4..1cf4604438 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",
Updated by Go MAEDA over 2 years ago
- Target version set to Candidate for next minor release
Updated by Go MAEDA over 2 years ago
- Target version changed from Candidate for next minor release to 4.2.4
Setting the target version to 4.2.4.
Updated by Go MAEDA over 2 years ago
- Subject changed from Duplicate activities in time entry report of project specific TimeEntryActivity to Duplicate activities in time entry report when project-specific activies exist
- Status changed from Confirmed to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you for your contribution.