Patch #2268
closedPatch to show Total Estimated Time at the bottom of each list of issues.
0%
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
Related issues
Updated by Eric Davis almost 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
Updated by Jean-Philippe Lang almost 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
Updated by Eric Davis almost 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"
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.
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.
Updated by Eric Davis over 15 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)))
Updated by Jean-Philippe Lang over 15 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.
Updated by Ewan Makepeace almost 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.
Updated by Victor Sergienko almost 14 years ago
Hi Evan,
Can you please share your patch in some way? I'd like to have it very much.
Thanks!
Updated by Etienne Massip over 13 years ago
- Category changed from Issues to Time tracking
Updated by Mischa The Evil almost 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
Updated by Jean-Philippe Lang over 11 years ago
- Status changed from 7 to New
Assigned issue with no assignee back to New status.
Updated by Henry Auffahrt over 9 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 :)
Updated by Muhammad Azmi Farih over 9 years ago
- File total_estimated_hour_2_6_4.diff total_estimated_hour_2_6_4.diff added
- File total_estimated_hour_2_6_4.sql total_estimated_hour_2_6_4.sql added
Hi All,
This patch is work on redmine 2.6.4.
Regards
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.
Updated by Muhammad Azmi Farih over 9 years ago
Please use this patch rather than previous, I have cleaned up the patch more correctly.