Select projects with issue_tracking module for gantt display and remove the nil start/due dates trick.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4477 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4715a37937
commit
b898200803
|
@ -449,24 +449,20 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
# The earliest start date of a project, based on it's issues and versions
|
# The earliest start date of a project, based on it's issues and versions
|
||||||
def start_date
|
def start_date
|
||||||
if module_enabled?(:issue_tracking)
|
[
|
||||||
[
|
issues.minimum('start_date'),
|
||||||
issues.minimum('start_date'),
|
shared_versions.collect(&:effective_date),
|
||||||
shared_versions.collect(&:effective_date),
|
shared_versions.collect {|v| v.fixed_issues.minimum('start_date')}
|
||||||
shared_versions.collect {|v| v.fixed_issues.minimum('start_date')}
|
].flatten.compact.min
|
||||||
].flatten.compact.min
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The latest due date of an issue or version
|
# The latest due date of an issue or version
|
||||||
def due_date
|
def due_date
|
||||||
if module_enabled?(:issue_tracking)
|
[
|
||||||
[
|
issues.maximum('due_date'),
|
||||||
issues.maximum('due_date'),
|
shared_versions.collect(&:effective_date),
|
||||||
shared_versions.collect(&:effective_date),
|
shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
|
||||||
shared_versions.collect {|v| v.fixed_issues.maximum('due_date')}
|
].flatten.compact.max
|
||||||
].flatten.compact.max
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def overdue?
|
def overdue?
|
||||||
|
|
|
@ -97,7 +97,7 @@ module Redmine
|
||||||
if @project
|
if @project
|
||||||
return number_of_rows_on_project(@project)
|
return number_of_rows_on_project(@project)
|
||||||
else
|
else
|
||||||
Project.roots.visible.inject(0) do |total, project|
|
Project.roots.visible.has_module('issue_tracking').inject(0) do |total, project|
|
||||||
total += number_of_rows_on_project(project)
|
total += number_of_rows_on_project(project)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -125,7 +125,7 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
# Subprojects
|
# Subprojects
|
||||||
project.children.visible.each do |subproject|
|
project.children.visible.has_module('issue_tracking').each do |subproject|
|
||||||
count += number_of_rows_on_project(subproject)
|
count += number_of_rows_on_project(subproject)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ module Redmine
|
||||||
if @project
|
if @project
|
||||||
render_project(@project, options)
|
render_project(@project, options)
|
||||||
else
|
else
|
||||||
Project.roots.visible.each do |project|
|
Project.roots.visible.has_module('issue_tracking').each do |project|
|
||||||
render_project(project, options)
|
render_project(project, options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -190,7 +190,7 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fourth, subprojects
|
# Fourth, subprojects
|
||||||
project.children.visible.each do |project|
|
project.children.visible.has_module('issue_tracking').each do |project|
|
||||||
render_project(project, options)
|
render_project(project, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -883,14 +883,6 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
assert_nil @project.start_date
|
assert_nil @project.start_date
|
||||||
end
|
end
|
||||||
|
|
||||||
should "be nil if issue tracking is disabled" do
|
|
||||||
Issue.generate_for_project!(@project, :start_date => Date.today)
|
|
||||||
@project.enabled_modules.find_all_by_name('issue_tracking').each {|m| m.destroy}
|
|
||||||
@project.reload
|
|
||||||
|
|
||||||
assert_nil @project.start_date
|
|
||||||
end
|
|
||||||
|
|
||||||
should "be tested when issues have no start date"
|
should "be tested when issues have no start date"
|
||||||
|
|
||||||
should "be the earliest start date of it's issues" do
|
should "be the earliest start date of it's issues" do
|
||||||
|
@ -914,14 +906,6 @@ class ProjectTest < ActiveSupport::TestCase
|
||||||
assert_nil @project.due_date
|
assert_nil @project.due_date
|
||||||
end
|
end
|
||||||
|
|
||||||
should "be nil if issue tracking is disabled" do
|
|
||||||
Issue.generate_for_project!(@project, :due_date => Date.today)
|
|
||||||
@project.enabled_modules.find_all_by_name('issue_tracking').each {|m| m.destroy}
|
|
||||||
@project.reload
|
|
||||||
|
|
||||||
assert_nil @project.due_date
|
|
||||||
end
|
|
||||||
|
|
||||||
should "be tested when issues have no due date"
|
should "be tested when issues have no due date"
|
||||||
|
|
||||||
should "be the latest due date of it's issues" do
|
should "be the latest due date of it's issues" do
|
||||||
|
|
Loading…
Reference in New Issue