Rewrite the Gantt chart. #6276
This version of the Gantt chart supports nested charts. So Projects, Versions, and Issues will be nested underneath their parents correctly. Additional features: * Move all Gantt code to Redmine::Helpers::Gantt class instead of having it in the Gantt class, controller, and view * Recursive and nest sub-projects * Recursive and nest versions * Recursive and nest issues * Draw a line showing when a Project is active and it's progress * Draw a line showing when a Version is active and it's progress * Show a version's % complete * Change the color of Projects, Versions, and Issues if they are late or behind schedule * Added Project#start_date and #due_date * Added Project#completed_percent * Use a mini-gravatar on the Gantt chart * Added tests for the Gantt rendering git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4072 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -104,7 +104,57 @@ class VersionTest < ActiveSupport::TestCase
|
||||
assert_progress_equal (25.0*0.2 + 25.0*1 + 10.0*0.3 + 40.0*0.1)/100.0*100, v.completed_pourcent
|
||||
assert_progress_equal 25.0/100.0*100, v.closed_pourcent
|
||||
end
|
||||
|
||||
|
||||
context "#behind_schedule?" do
|
||||
setup do
|
||||
ProjectCustomField.destroy_all # Custom values are a mess to isolate in tests
|
||||
@project = Project.generate!(:identifier => 'test0')
|
||||
@project.trackers << Tracker.generate!
|
||||
|
||||
@version = Version.generate!(:project => @project, :effective_date => nil)
|
||||
end
|
||||
|
||||
should "be false if there are no issues assigned" do
|
||||
@version.update_attribute(:effective_date, Date.yesterday)
|
||||
assert_equal false, @version.behind_schedule?
|
||||
end
|
||||
|
||||
should "be false if there is no effective_date" do
|
||||
assert_equal false, @version.behind_schedule?
|
||||
end
|
||||
|
||||
should "be false if all of the issues are ahead of schedule" do
|
||||
@version.update_attribute(:effective_date, 7.days.from_now.to_date)
|
||||
@version.fixed_issues = [
|
||||
Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 60), # 14 day span, 60% done, 50% time left
|
||||
Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
|
||||
]
|
||||
assert_equal 60, @version.completed_pourcent
|
||||
assert_equal false, @version.behind_schedule?
|
||||
end
|
||||
|
||||
should "be true if any of the issues are behind schedule" do
|
||||
@version.update_attribute(:effective_date, 7.days.from_now.to_date)
|
||||
@version.fixed_issues = [
|
||||
Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 60), # 14 day span, 60% done, 50% time left
|
||||
Issue.generate_for_project!(@project, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
|
||||
]
|
||||
assert_equal 40, @version.completed_pourcent
|
||||
assert_equal true, @version.behind_schedule?
|
||||
end
|
||||
|
||||
should "be false if all of the issues are complete" do
|
||||
@version.update_attribute(:effective_date, 7.days.from_now.to_date)
|
||||
@version.fixed_issues = [
|
||||
Issue.generate_for_project!(@project, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)), # 7 day span
|
||||
Issue.generate_for_project!(@project, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
|
||||
]
|
||||
assert_equal 100, @version.completed_pourcent
|
||||
assert_equal false, @version.behind_schedule?
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
context "#estimated_hours" do
|
||||
setup do
|
||||
@version = Version.create!(:project_id => 1, :name => '#estimated_hours')
|
||||
|
||||
Reference in New Issue
Block a user