Propagates time tracking to the parent project (closes #433). Time report enhancements.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1176 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Vendored
+18
-3
@@ -6,7 +6,7 @@ time_entries_001:
|
||||
project_id: 1
|
||||
comments: My hours
|
||||
updated_on: 2007-03-23 12:54:18 +01:00
|
||||
activity_id: 8
|
||||
activity_id: 9
|
||||
spent_on: 2007-03-23
|
||||
issue_id: 1
|
||||
id: 1
|
||||
@@ -20,7 +20,7 @@ time_entries_002:
|
||||
project_id: 1
|
||||
comments: ""
|
||||
updated_on: 2007-03-23 14:11:04 +01:00
|
||||
activity_id: 8
|
||||
activity_id: 9
|
||||
spent_on: 2007-03-12
|
||||
issue_id: 1
|
||||
id: 2
|
||||
@@ -34,10 +34,25 @@ time_entries_003:
|
||||
project_id: 1
|
||||
comments: ""
|
||||
updated_on: 2007-04-21 12:20:48 +02:00
|
||||
activity_id: 8
|
||||
activity_id: 9
|
||||
spent_on: 2007-04-21
|
||||
issue_id: 2
|
||||
id: 3
|
||||
hours: 1.0
|
||||
user_id: 1
|
||||
tyear: 2007
|
||||
time_entries_004:
|
||||
created_on: 2007-04-22 12:20:48 +02:00
|
||||
tweek: 16
|
||||
tmonth: 4
|
||||
project_id: 3
|
||||
comments: Time spent on a subproject
|
||||
updated_on: 2007-04-22 12:20:48 +02:00
|
||||
activity_id: 10
|
||||
spent_on: 2007-04-22
|
||||
issue_id:
|
||||
id: 4
|
||||
hours: 7.65
|
||||
user_id: 1
|
||||
tyear: 2007
|
||||
|
||||
@@ -37,27 +37,39 @@ class TimelogControllerTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_report_one_criteria
|
||||
get :report, :project_id => 1, :period => "month", :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member"]
|
||||
get :report, :project_id => 1, :period => 'week', :date_from => "2007-04-01", :date_to => "2007-04-30", :criterias => ['project']
|
||||
assert_response :success
|
||||
assert_template 'report'
|
||||
assert_not_nil assigns(:hours)
|
||||
end
|
||||
assert_not_nil assigns(:total_hours)
|
||||
assert_equal "8.65", "%.2f" % assigns(:total_hours)
|
||||
end
|
||||
|
||||
def test_report_two_criterias
|
||||
get :report, :project_id => 1, :period => "week", :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
|
||||
get :report, :project_id => 1, :period => 'month', :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
|
||||
assert_response :success
|
||||
assert_template 'report'
|
||||
assert_not_nil assigns(:hours)
|
||||
assert_not_nil assigns(:total_hours)
|
||||
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||||
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']
|
||||
assert_response :success
|
||||
assert_template 'report'
|
||||
assert_not_nil assigns(:total_hours)
|
||||
assert_equal "0.00", "%.2f" % assigns(:total_hours)
|
||||
end
|
||||
|
||||
def test_details_at_project_level
|
||||
get :details, :project_id => 1
|
||||
assert_response :success
|
||||
assert_template 'details'
|
||||
assert_not_nil assigns(:entries)
|
||||
assert_equal 3, assigns(:entries).size
|
||||
assert_equal 4, assigns(:entries).size
|
||||
# project and subproject
|
||||
assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
|
||||
assert_not_nil assigns(:total_hours)
|
||||
assert_equal 155.25, assigns(:total_hours)
|
||||
assert_equal "162.90", "%.2f" % assigns(:total_hours)
|
||||
# display all time by default
|
||||
assert_nil assigns(:from)
|
||||
assert_nil assigns(:to)
|
||||
@@ -68,9 +80,9 @@ class TimelogControllerTest < Test::Unit::TestCase
|
||||
assert_response :success
|
||||
assert_template 'details'
|
||||
assert_not_nil assigns(:entries)
|
||||
assert_equal 2, assigns(:entries).size
|
||||
assert_equal 3, assigns(:entries).size
|
||||
assert_not_nil assigns(:total_hours)
|
||||
assert_equal 5.25, assigns(:total_hours)
|
||||
assert_equal "12.90", "%.2f" % assigns(:total_hours)
|
||||
assert_equal '2007-03-20'.to_date, assigns(:from)
|
||||
assert_equal '2007-04-30'.to_date, assigns(:to)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user