@@ -449,24 +449,20 class Project < ActiveRecord::Base | |||||
449 |
|
449 | |||
450 | # The earliest start date of a project, based on it's issues and versions |
|
450 | # The earliest start date of a project, based on it's issues and versions | |
451 | def start_date |
|
451 | def start_date | |
452 | if module_enabled?(:issue_tracking) |
|
452 | [ | |
453 | [ |
|
453 | issues.minimum('start_date'), | |
454 | issues.minimum('start_date'), |
|
454 | shared_versions.collect(&:effective_date), | |
455 |
|
|
455 | shared_versions.collect {|v| v.fixed_issues.minimum('start_date')} | |
456 | shared_versions.collect {|v| v.fixed_issues.minimum('start_date')} |
|
456 | ].flatten.compact.min | |
457 | ].flatten.compact.min |
|
|||
458 | end |
|
|||
459 | end |
|
457 | end | |
460 |
|
458 | |||
461 | # The latest due date of an issue or version |
|
459 | # The latest due date of an issue or version | |
462 | def due_date |
|
460 | def due_date | |
463 | if module_enabled?(:issue_tracking) |
|
461 | [ | |
464 | [ |
|
462 | issues.maximum('due_date'), | |
465 | issues.maximum('due_date'), |
|
463 | shared_versions.collect(&:effective_date), | |
466 |
|
|
464 | shared_versions.collect {|v| v.fixed_issues.maximum('due_date')} | |
467 | shared_versions.collect {|v| v.fixed_issues.maximum('due_date')} |
|
465 | ].flatten.compact.max | |
468 | ].flatten.compact.max |
|
|||
469 | end |
|
|||
470 | end |
|
466 | end | |
471 |
|
467 | |||
472 | def overdue? |
|
468 | def overdue? |
@@ -97,7 +97,7 module Redmine | |||||
97 | if @project |
|
97 | if @project | |
98 | return number_of_rows_on_project(@project) |
|
98 | return number_of_rows_on_project(@project) | |
99 | else |
|
99 | else | |
100 | Project.roots.visible.inject(0) do |total, project| |
|
100 | Project.roots.visible.has_module('issue_tracking').inject(0) do |total, project| | |
101 | total += number_of_rows_on_project(project) |
|
101 | total += number_of_rows_on_project(project) | |
102 | end |
|
102 | end | |
103 | end |
|
103 | end | |
@@ -125,7 +125,7 module Redmine | |||||
125 | end |
|
125 | end | |
126 |
|
126 | |||
127 | # Subprojects |
|
127 | # Subprojects | |
128 | project.children.visible.each do |subproject| |
|
128 | project.children.visible.has_module('issue_tracking').each do |subproject| | |
129 | count += number_of_rows_on_project(subproject) |
|
129 | count += number_of_rows_on_project(subproject) | |
130 | end |
|
130 | end | |
131 |
|
131 | |||
@@ -154,7 +154,7 module Redmine | |||||
154 | if @project |
|
154 | if @project | |
155 | render_project(@project, options) |
|
155 | render_project(@project, options) | |
156 | else |
|
156 | else | |
157 | Project.roots.visible.each do |project| |
|
157 | Project.roots.visible.has_module('issue_tracking').each do |project| | |
158 | render_project(project, options) |
|
158 | render_project(project, options) | |
159 | end |
|
159 | end | |
160 | end |
|
160 | end | |
@@ -190,7 +190,7 module Redmine | |||||
190 | end |
|
190 | end | |
191 |
|
191 | |||
192 | # Fourth, subprojects |
|
192 | # Fourth, subprojects | |
193 | project.children.visible.each do |project| |
|
193 | project.children.visible.has_module('issue_tracking').each do |project| | |
194 | render_project(project, options) |
|
194 | render_project(project, options) | |
195 | end |
|
195 | end | |
196 |
|
196 |
@@ -882,14 +882,6 class ProjectTest < ActiveSupport::TestCase | |||||
882 | should "be nil if there are no issues on the project" do |
|
882 | should "be nil if there are no issues on the project" do | |
883 | assert_nil @project.start_date |
|
883 | assert_nil @project.start_date | |
884 | end |
|
884 | end | |
885 |
|
||||
886 | should "be nil if issue tracking is disabled" do |
|
|||
887 | Issue.generate_for_project!(@project, :start_date => Date.today) |
|
|||
888 | @project.enabled_modules.find_all_by_name('issue_tracking').each {|m| m.destroy} |
|
|||
889 | @project.reload |
|
|||
890 |
|
||||
891 | assert_nil @project.start_date |
|
|||
892 | end |
|
|||
893 |
|
885 | |||
894 | should "be tested when issues have no start date" |
|
886 | should "be tested when issues have no start date" | |
895 |
|
887 | |||
@@ -913,14 +905,6 class ProjectTest < ActiveSupport::TestCase | |||||
913 | should "be nil if there are no issues on the project" do |
|
905 | should "be nil if there are no issues on the project" do | |
914 | assert_nil @project.due_date |
|
906 | assert_nil @project.due_date | |
915 | end |
|
907 | end | |
916 |
|
||||
917 | should "be nil if issue tracking is disabled" do |
|
|||
918 | Issue.generate_for_project!(@project, :due_date => Date.today) |
|
|||
919 | @project.enabled_modules.find_all_by_name('issue_tracking').each {|m| m.destroy} |
|
|||
920 | @project.reload |
|
|||
921 |
|
||||
922 | assert_nil @project.due_date |
|
|||
923 | end |
|
|||
924 |
|
908 | |||
925 | should "be tested when issues have no due date" |
|
909 | should "be tested when issues have no due date" | |
926 |
|
910 |
General Comments 0
You need to be logged in to leave comments.
Login now