Actions
Defect #12803
closedCross-year date range in time tracking report misses some hours
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Duplicate
Affected version:
Description
How to reproduce:
- Have some tickets that have time tracked in both 2012 and 2013.
- Select "last 2 weeks" date preset (or manually enter 2012-12-24 to 2013-01-06)
- Select the Report tab
- Add Details | Week- Project
- Add Details | Week- Issue
- Note that the total at the top of the report does not equal the total in the bottom right corner of the report. Times from 2013 have been omitted, although the projects and issues are included.
- Also note that the weeks shown in the column headers are 2012-52 and 2012-1
This has also been reported to be a problem in 1.4.4.stable.9879.
Related issues
Updated by Uwe Koloska almost 12 years ago
Here is a patch against 1.4.4.stable.9879 (the lines that have to be changed are the same in trunk)
--- lib/redmine/helpers/time_report.rb (Revision 9879)
+++ lib/redmine/helpers/time_report.rb (Arbeitskopie)
@@ -67,7 +67,7 @@
when 'month'
row['month'] = "#{row['tyear']}-#{row['tmonth']}"
when 'week'
- row['week'] = "#{row['tyear']}-#{row['tweek']}"
+ row['week'] = Date.parse("#{row['spent_on']}").cwyear.to_s + "-#{row['tweek']}"
when 'day'
row['day'] = "#{row['spent_on']}"
end
@@ -98,7 +98,7 @@
@periods << "#{date_from.year}-#{date_from.month}"
date_from = (date_from + 1.month).at_beginning_of_month
when 'week'
- @periods << "#{date_from.year}-#{date_from.to_date.cweek}"
+ @periods << "#{date_from.to_date.cwyear}-#{date_from.to_date.cweek}"
date_from = (date_from + 7.day).at_beginning_of_week
when 'day'
@periods << "#{date_from.to_date}"
Reason is the difference between the year for the week and the year from the date. The first ISO week of this year looks like this in the time_entries
table:
tyear | tmonth | tweek | spent_on |
---|---|---|---|
2012 | 12 | 1 | 2012-12-31 |
2013 | 1 | 1 | 2013-01-01 |
2013 | 1 | 1 | 2013-01-02 |
2013 | 1 | 1 | 2013-01-03 |
- is there a more elegant way to get the year for the ISO week than parsing
spent_on
? - How can I create a test for this bug?
- How can I use the logger in this function?
logger.debug
givesundefined local variable or method `logger'
Updated by Jean-Philippe Lang almost 12 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
Actions