@@ -63,7 +63,7 module Redmine | |||
|
63 | 63 | when 'month' |
|
64 | 64 | row['month'] = "#{row['tyear']}-#{row['tmonth']}" |
|
65 | 65 | when 'week' |
|
66 |
row['week'] = "#{row[' |
|
|
66 | row['week'] = "#{row['spent_on'].cwyear}-#{row['tweek']}" | |
|
67 | 67 | when 'day' |
|
68 | 68 | row['day'] = "#{row['spent_on']}" |
|
69 | 69 | end |
@@ -90,7 +90,7 module Redmine | |||
|
90 | 90 | @periods << "#{date_from.year}-#{date_from.month}" |
|
91 | 91 | date_from = (date_from + 1.month).at_beginning_of_month |
|
92 | 92 | when 'week' |
|
93 | @periods << "#{date_from.year}-#{date_from.to_date.cweek}" | |
|
93 | @periods << "#{date_from.to_date.cwyear}-#{date_from.to_date.cweek}" | |
|
94 | 94 | date_from = (date_from + 7.day).at_beginning_of_week |
|
95 | 95 | when 'day' |
|
96 | 96 | @periods << "#{date_from.to_date}" |
@@ -125,6 +125,32 class TimeEntryReportsControllerTest < ActionController::TestCase | |||
|
125 | 125 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} |
|
126 | 126 | end |
|
127 | 127 | |
|
128 | def test_report_by_week_should_use_commercial_year | |
|
129 | TimeEntry.delete_all | |
|
130 | TimeEntry.generate!(:hours => '2', :spent_on => '2009-12-25') # 2009-52 | |
|
131 | TimeEntry.generate!(:hours => '4', :spent_on => '2009-12-31') # 2009-53 | |
|
132 | TimeEntry.generate!(:hours => '8', :spent_on => '2010-01-01') # 2009-53 | |
|
133 | TimeEntry.generate!(:hours => '16', :spent_on => '2010-01-05') # 2010-1 | |
|
134 | ||
|
135 | get :report, :columns => 'week', :from => "2009-12-25", :to => "2010-01-05", :criteria => ["project"] | |
|
136 | assert_response :success | |
|
137 | ||
|
138 | assert_select '#time-report thead tr' do | |
|
139 | assert_select 'th:nth-child(1)', :text => 'Project' | |
|
140 | assert_select 'th:nth-child(2)', :text => '2009-52' | |
|
141 | assert_select 'th:nth-child(3)', :text => '2009-53' | |
|
142 | assert_select 'th:nth-child(4)', :text => '2010-1' | |
|
143 | assert_select 'th:nth-child(5)', :text => 'Total' | |
|
144 | end | |
|
145 | assert_select '#time-report tbody tr' do | |
|
146 | assert_select 'td:nth-child(1)', :text => 'eCookbook' | |
|
147 | assert_select 'td:nth-child(2)', :text => '2.00' | |
|
148 | assert_select 'td:nth-child(3)', :text => '12.00' | |
|
149 | assert_select 'td:nth-child(4)', :text => '16.00' | |
|
150 | assert_select 'td:nth-child(5)', :text => '30.00' # Total | |
|
151 | end | |
|
152 | end | |
|
153 | ||
|
128 | 154 | def test_report_should_propose_association_custom_fields |
|
129 | 155 | get :report |
|
130 | 156 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now