プロジェクト

全般

プロフィール

Vote #76435

完了

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

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Time tracking_13
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
13
version_id:
172
issue_org_id:
20018
author_id:
123866
assigned_to_id:
332
comments:
15
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
116
ステータス-->[Closed]

説明

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:

h2. Observed:

Activity    Total
X           3
X           4
Y           5
Y           6
Z           7

h2. 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


journals

Do you mean time time entry report?
And give us more information: [[Submissions]].
--------------------------------------------------------------------------------
Yes, I mean the time entry report in general, not for a particular project.

<pre>
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
</pre>

here is an extract of my database for enumerations. I found several entries for the same name, which are linked to different projects:
<pre>
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 |
</pre>

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

!report_activities.PNG!

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

!report_activities_projects.PNG!
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
#21056#note-8 :
> Is a consequence of this issue
See [[Submissions]] and give us what plugins you uses.
--------------------------------------------------------------------------------
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):

<pre>
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
</pre>

Steps to follow using a fresh redmine install:

Create a new activity, do not check "Active":

!1.PNG!

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:

!2.PNG!

Now that the activities are activated, time to log some time on each project:

!3.PNG!

and

!4.PNG!

Then click 1, then 2 on following:

!5.PNG!

Then click on the "Report" Button

!6.PNG!

Then click "Activity" in the Add section:

!7.PNG!

Result:

!8.PNG!

I hope these instructions are clear enough to be reproduced :)

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
<pre>
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)
</pre>
--------------------------------------------------------------------------------
up

This still happens on Redmine 3.3.0.stable
--------------------------------------------------------------------------------
I also confirmed(trunk: r21299). I think the following patch will solve it.

<pre><code class="diff">
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",
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Setting the target version to 4.2.4.
--------------------------------------------------------------------------------
Committed the patch. Thank you for your contribution.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,21056,Project specific TimeEntryActivity name not updating properly

Admin Redmine さんが約4年前に更新

  • カテゴリTime tracking_13 にセット
  • 対象バージョン4.2.4_172 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0