Project

General

Profile

Actions

Defect #20018

closed

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

Added by Stephane Evr almost 9 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Time tracking
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

report_activities.PNG (21 KB) report_activities.PNG Stephane Evr, 2015-07-09 10:33
report_activities_projects.PNG (27.3 KB) report_activities_projects.PNG Stephane Evr, 2015-07-09 10:33
1.PNG (7.74 KB) 1.PNG Stephane Evr, 2016-04-14 11:55
2.PNG (16.2 KB) 2.PNG Stephane Evr, 2016-04-14 11:56
3.PNG (11.9 KB) 3.PNG Stephane Evr, 2016-04-14 12:00
4.PNG (11.9 KB) 4.PNG Stephane Evr, 2016-04-14 12:00
5.PNG (10.9 KB) 5.PNG Stephane Evr, 2016-04-14 12:02
6.PNG (26.1 KB) 6.PNG Stephane Evr, 2016-04-14 12:04
7.PNG (17.5 KB) 7.PNG Stephane Evr, 2016-04-14 12:05
8.PNG (24.9 KB) 8.PNG Stephane Evr, 2016-04-14 12:06
20018.patch (1.76 KB) 20018.patch Yuichi HARADA, 2021-12-06 06:45

Related issues

Related to Redmine - Defect #21056: Project specific TimeEntryActivity name not updating properlyClosedGo MAEDA

Actions
Actions #1

Updated by Toshi MARUYAMA over 8 years ago

  • Status changed from New to Needs feedback

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

Actions #2

Updated by Stephane Evr over 8 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          |

Actions #3

Updated by Stephane Evr over 8 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):

Actions #4

Updated by Toshi MARUYAMA over 8 years ago

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

Updated by Toshi MARUYAMA almost 8 years ago

#21056#note-8 :

Is a consequence of this issue

See Submissions and give us what plugins you uses.

Actions #6

Updated by Stephane Evr almost 8 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 :)

Actions #7

Updated by Toshi MARUYAMA almost 8 years ago

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

Updated by Toshi MARUYAMA almost 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
Actions #9

Updated by Toshi MARUYAMA almost 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)
Actions #10

Updated by Stephane Evr almost 7 years ago

up

This still happens on Redmine 3.3.0.stable

Actions #11

Updated by Yuichi HARADA over 2 years 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",
Actions #12

Updated by Go MAEDA over 2 years ago

  • Target version set to Candidate for next minor release
Actions #13

Updated by Go MAEDA about 2 years ago

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

Setting the target version to 4.2.4.

Actions #14

Updated by Go MAEDA about 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.

Actions #15

Updated by Go MAEDA about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF