Defect #20018

Duplicate activities in time entry report when project-specific activies exist

Added by Stephane Evr about 7 years ago. Updated 6 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

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

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

report_activities.PNG (21 KB) Stephane Evr, 2015-07-09 10:33

report_activities_projects.PNG (27.3 KB) Stephane Evr, 2015-07-09 10:33

1.PNG (7.74 KB) Stephane Evr, 2016-04-14 11:55

2.PNG (16.2 KB) Stephane Evr, 2016-04-14 11:56

3.PNG (11.9 KB) Stephane Evr, 2016-04-14 12:00

4.PNG (11.9 KB) Stephane Evr, 2016-04-14 12:00

5.PNG (10.9 KB) Stephane Evr, 2016-04-14 12:02

6.PNG (26.1 KB) Stephane Evr, 2016-04-14 12:04

7.PNG (17.5 KB) Stephane Evr, 2016-04-14 12:05

8.PNG (24.9 KB) Stephane Evr, 2016-04-14 12:06

20018.patch Magnifier (1.76 KB) Yuichi HARADA, 2021-12-06 06:45


Related issues

Related to Redmine - Defect #21056: Project specific TimeEntryActivity name not updating prop... Closed

Associated revisions

Revision 21371
Added by Go MAEDA 7 months ago

Duplicate activities in time entry report when project-specific activies exist (#20018).

Patch by Yuichi HARADA.

Revision 21388
Added by Go MAEDA 6 months ago

Merged r21371 from trunk to 4.2-stable (#20018).

History

#1 Updated by Toshi MARUYAMA about 7 years ago

  • Status changed from New to Needs feedback

Do you mean time time entry report?
And give us more information: Submissions.

#2 Updated by Stephane Evr about 7 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          |

#3 Updated by Stephane Evr about 7 years ago

Here is what I get for an activity called "Other":

Now, If I add the "Projects" column (Each line is a different project):

#4 Updated by Toshi MARUYAMA about 7 years ago

  • Category set to Time tracking
  • Status changed from Needs feedback to New

#5 Updated by Toshi MARUYAMA over 6 years ago

#21056#note-8 :

Is a consequence of this issue

See Submissions and give us what plugins you uses.

#6 Updated by Stephane Evr over 6 years ago

Toshi MARUYAMA wrote:

#21056#note-8 :

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 :)

#7 Updated by Toshi MARUYAMA about 6 years ago

  • Related to Defect #21056: Project specific TimeEntryActivity name not updating properly added

#8 Updated by Toshi MARUYAMA about 6 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

#9 Updated by Toshi MARUYAMA about 6 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)

#10 Updated by Stephane Evr about 5 years ago

up

This still happens on Redmine 3.3.0.stable

#11 Updated by Yuichi HARADA 8 months ago

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",

#12 Updated by Go MAEDA 8 months ago

  • Target version set to Candidate for next minor release

#13 Updated by Go MAEDA 7 months ago

  • Target version changed from Candidate for next minor release to 4.2.4

Setting the target version to 4.2.4.

#14 Updated by Go MAEDA 7 months 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.

#15 Updated by Go MAEDA 6 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF