Project

General

Profile

Actions

Patch #2268

closed

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

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

Added by Ewan Makepeace almost 18 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-

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 5 (0 open — 5 closed)

Related to Redmine - Feature #1561: Totals for estimated/spent time and numeric custom fields on the issue listClosedJean-Philippe LangActions
Related to Redmine - Feature #6571: Totalise numeric columnsClosedActions
Related to Redmine - Feature #8559: Sum columns in reportsClosedActions
Has duplicate Redmine - Feature #1374: Estimated hours sum in query listingClosedActions
Precedes Redmine - Patch #4776: Totals for Estimated TimeClosedActions

Updated by Eric Davis almost 18 years ago Actions #1

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

Updated by Jean-Philippe Lang almost 18 years ago Actions #2

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

Updated by Eric Davis almost 18 years ago Actions #3

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"

Updated by Eric Davis almost 18 years ago Actions #4

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

Updated by Ewan Makepeace almost 18 years ago Actions #5

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.

Updated by Eric Davis almost 18 years ago Actions #6

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

Updated by Jean-Philippe Lang almost 18 years ago Actions #7

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.

Updated by Eric Davis about 16 years ago Actions #8

  • Assignee deleted (Eric Davis)

Updated by Ewan Makepeace about 16 years ago Actions #9

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.

Updated by Victor Sergienko about 16 years ago Actions #10

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

Updated by Etienne Massip almost 16 years ago Actions #11

  • Category changed from Issues to Time tracking

Updated by Ewan Makepeace over 15 years ago Actions #12

Victor See here: #4776

Updated by Mischa The Evil about 15 years ago Actions #13

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

Updated by Jean-Philippe Lang almost 14 years ago Actions #14

  • Status changed from 7 to New

Assigned issue with no assignee back to New status.

Updated by Sergey W about 12 years ago Actions #15

are there sulutions for redmine 2.5 ?

Updated by Henry Auffahrt almost 12 years ago Actions #16

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

Updated by Anonymous over 11 years ago Actions #17

Updated by Ewan Makepeace over 11 years ago Actions #18

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.

Updated by Anonymous over 11 years ago Actions #19

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

Updated by Toshi MARUYAMA almost 11 years ago Actions #20

  • Status changed from New to Closed

Fixed by #1561.

Actions

Also available in: PDF Atom