@@ -63,7 +63,7 module Redmine | |||||
63 | when 'month' |
|
63 | when 'month' | |
64 | row['month'] = "#{row['tyear']}-#{row['tmonth']}" |
|
64 | row['month'] = "#{row['tyear']}-#{row['tmonth']}" | |
65 | when 'week' |
|
65 | when 'week' | |
66 |
row['week'] = "#{row[' |
|
66 | row['week'] = "#{row['spent_on'].cwyear}-#{row['tweek']}" | |
67 | when 'day' |
|
67 | when 'day' | |
68 | row['day'] = "#{row['spent_on']}" |
|
68 | row['day'] = "#{row['spent_on']}" | |
69 | end |
|
69 | end | |
@@ -90,7 +90,7 module Redmine | |||||
90 | @periods << "#{date_from.year}-#{date_from.month}" |
|
90 | @periods << "#{date_from.year}-#{date_from.month}" | |
91 | date_from = (date_from + 1.month).at_beginning_of_month |
|
91 | date_from = (date_from + 1.month).at_beginning_of_month | |
92 | when 'week' |
|
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 | date_from = (date_from + 7.day).at_beginning_of_week |
|
94 | date_from = (date_from + 7.day).at_beginning_of_week | |
95 | when 'day' |
|
95 | when 'day' | |
96 | @periods << "#{date_from.to_date}" |
|
96 | @periods << "#{date_from.to_date}" |
@@ -125,6 +125,32 class TimeEntryReportsControllerTest < ActionController::TestCase | |||||
125 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} |
|
125 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} | |
126 | end |
|
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 | def test_report_should_propose_association_custom_fields |
|
154 | def test_report_should_propose_association_custom_fields | |
129 | get :report |
|
155 | get :report | |
130 | assert_response :success |
|
156 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now