Project

General

Profile

Actions

Patch #2268

closed

Patch to show Total Estimated Time at the bottom of each list of issues.

Added by Ewan Makepeace about 16 years ago. Updated almost 9 years ago.

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

0%

Estimated time:

Description

Provides a total of estimated time for all the issues in a list, like this:

Not totally certain this is the correct file format and naming - first try at uploading a patch.


Files

total_estimated_hour.diff (991 Bytes) total_estimated_hour.diff Ewan Makepeace, 2008-12-03 04:55
times.jpg (66.5 KB) times.jpg Ewan Makepeace, 2010-10-25 22:49
total_estimated_hour_2_6_4.sql (64 Bytes) total_estimated_hour_2_6_4.sql Anonymous, 2015-04-27 12:02
total_estimated_hour_2_6_4.diff (37.2 KB) total_estimated_hour_2_6_4.diff Anonymous, 2015-04-27 12:02
total_estimated_hour_2_6_4_edited.diff (12.7 KB) total_estimated_hour_2_6_4_edited.diff Anonymous, 2015-05-04 09:58

Related issues

Related to Redmine - Feature #1561: Totals for estimated/spent time and numeric custom fields on the issue listClosedJean-Philippe Lang2008-07-02

Actions
Related to Redmine - Feature #6571: Totalise numeric columnsClosed2010-10-05

Actions
Related to Redmine - Feature #8559: Sum columns in reportsClosed2011-06-07

Actions
Has duplicate Redmine - Feature #1374: Estimated hours sum in query listingClosed2008-06-04

Actions
Precedes Redmine - Patch #4776: Totals for Estimated TimeClosed2010-02-09

Actions
Actions #1

Updated by Eric Davis about 16 years ago

The patch is a good start and is in the correct format. There are a couple of improvements:

  • Using send isn't necessary. issue.estimated_hours would work
  • Some unit tests would be helpful

Another improvement would be to replace the entire loop with:

@issues.collect(&:estimated_hours).reject {|hours| hours.nil?}.sum
Actions #2

Updated by Jean-Philippe Lang about 16 years ago

Or:

@issues.collect(&:estimated_hours).compact.sum

But the problem is that it calculates the total for the issues that are displayed only.
If the issue list has more than one page, this is a partial sum.

If we really want to add this feature, we'd better do a query to sum the estimated hours of all the filtered issues. IMHO, it makes more sense.

Adding something like this to the controller should almost work (not tested):

@estimated = Issue.sum :estimated_hours, 
                       :include => [ :status, :project ],
                       :conditions => @query.statement
Actions #3

Updated by Eric Davis about 16 years ago

Jean-Philippe Lang wrote:

But the problem is that it calculates the total for the issues that are displayed only.
If the issue list has more than one page, this is a partial sum.

Opps, I thought that was what the feature was for "xxx time in the list"

Actions #4

Updated by Eric Davis almost 16 years ago

  • Status changed from New to 7
  • Assignee set to Eric Davis

I've got a working patch for this feature, I'll commit it soon.

Actions #5

Updated by Ewan Makepeace almost 16 years ago

Adding up the total estimated time for all issues (visible or not) might be dangerous - what if we click "All Issues" on a big database with thousands of issues - will they all be loaded into memory in order to sum their estimated time (unsure whether Active Record does this in memory or is smart and just calls "Select sum(EstimatedTime) from ..." ect).

I use the original patch daily and am very happy with it - if it is to be improved I would rather see subtotals for each discrete value in the sorted column before grand totals for all records.

Actions #6

Updated by Eric Davis almost 16 years ago

Ewan Makepeace: Good thinking. Active Record does it as a single SUM query so it should be fine.

SQL (0.000110) SELECT sum(`issues`.estimated_hours) AS sum_estimated_hours FROM `issues` LEFT OUTER JOIN `issue_statuses` ON `issue_statuses`.id = `issues`.status_id LEFT OUTER JOIN `projects` ON `projects`.id = `issues`.project_id WHERE ((issue_statuses.is_closed=0) AND ((projects.status=1 AND EXISTS (SELECT em.id FROM enabled_modules em WHERE em.name='issue_tracking' AND em.project_id=projects.id)) AND (1=0 OR projects.is_public = 1)))

Actions #7

Updated by Jean-Philippe Lang almost 16 years ago

Ewan Makepeace wrote:

Adding up the total estimated time for all issues (visible or not) might be dangerous - what if we click "All Issues" on a big database with thousands of issues - will they all be loaded into memory in order to sum their estimated time (unsure whether Active Record does this in memory or is smart and just calls "Select sum(EstimatedTime) from ..." ect).

I wouldn't have submitted such code if I was unsure of what Issue.sum does.

Actions #8

Updated by Eric Davis about 14 years ago

  • Assignee deleted (Eric Davis)
Actions #9

Updated by Ewan Makepeace about 14 years ago

Eric, we are still using a version of this patch today (some changes since the first version I think). It gives us issue count and total estimated time per group plus page and query totals of estimated time:

Let me know if any interest in our current patch.

Actions #10

Updated by Victor Sergienko about 14 years ago

Hi Evan,
Can you please share your patch in some way? I'd like to have it very much.
Thanks!

Actions #11

Updated by Etienne Massip almost 14 years ago

  • Category changed from Issues to Time tracking
Actions #12

Updated by Ewan Makepeace over 13 years ago

Victor See here: #4776

Actions #13

Updated by Mischa The Evil about 13 years ago

As mentioned the first time by Tony Marschall in #8559 note-4, there exists a plugin which provides (parts of) this feature (along with some others): Redmine spent time column. It's written by Jan Schulz-Hofen of plan.io.

I've started working on some improvements to make it better suitable for this issue in my fork of it:
https://github.com/MischaTheEvil/redmine_spent_time_column

Actions #14

Updated by Jean-Philippe Lang almost 12 years ago

  • Status changed from 7 to New

Assigned issue with no assignee back to New status.

Actions #15

Updated by Sergey W over 10 years ago

are there sulutions for redmine 2.5 ?

Actions #16

Updated by Henry Auffahrt almost 10 years ago

Mischa The Evil The Evil,
as i see i can not install your fork of the plugin, maybe because we use redmine 2.6.1???

@all
This would be an awesome feature for us! We want to use our redmine system for our capacity planning. This would improve our work enormously :)

Actions #17

Updated by Anonymous over 9 years ago

Hi All,

This patch is work on redmine 2.6.4.

Regards

Actions #18

Updated by Ewan Makepeace over 9 years ago

To clarify - the previous post by Muhammad Azmi contains the current version of our patches to show estimated time totals on groups and at the foot of pages as originally described.

Actions #19

Updated by Anonymous over 9 years ago

Please use this patch rather than previous, I have cleaned up the patch more correctly.

Actions #20

Updated by Toshi MARUYAMA almost 9 years ago

  • Status changed from New to Closed

Fixed by #1561.

Actions

Also available in: Atom PDF