Add predefined date ranges to the time report in the same way as the details view (closes #972). It nows defaults to 'All time'.

This patch also fixes time report periods (columns) computation.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1318 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-04-01 19:40:40 +00:00
parent e4da9d6f10
commit 043cb37b16
5 changed files with 108 additions and 105 deletions
+13 -5
View File
@@ -78,17 +78,25 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'report'
end
def test_report_all_time
get :report, :project_id => 1, :criterias => ['project']
assert_response :success
assert_template 'report'
assert_not_nil assigns(:total_hours)
assert_equal "162.90", "%.2f" % assigns(:total_hours)
end
def test_report_one_criteria
get :report, :project_id => 1, :period => 'week', :date_from => "2007-04-01", :date_to => "2007-04-30", :criterias => ['project']
get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project']
assert_response :success
assert_template 'report'
assert_not_nil assigns(:total_hours)
assert_equal "8.65", "%.2f" % assigns(:total_hours)
end
end
def test_report_two_criterias
get :report, :project_id => 1, :period => 'month', :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"]
assert_response :success
assert_template 'report'
assert_not_nil assigns(:total_hours)
@@ -96,7 +104,7 @@ class TimelogControllerTest < Test::Unit::TestCase
end
def test_report_one_criteria_no_result
get :report, :project_id => 1, :period => 'week', :date_from => "1998-04-01", :date_to => "1998-04-30", :criterias => ['project']
get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criterias => ['project']
assert_response :success
assert_template 'report'
assert_not_nil assigns(:total_hours)