##// END OF EJS Templates
Deprecates Version#*_pourcent in favour of #*_percent (#12724)....
Jean-Philippe Lang -
r10883:9613a13b10aa
parent child
Show More
@@ -1026,7 +1026,7 module ApplicationHelper
1026 1026 (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : ''.html_safe) +
1027 1027 (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : ''.html_safe)
1028 1028 ), :class => 'progress', :style => "width: #{width};").html_safe +
1029 content_tag('p', legend, :class => 'pourcent').html_safe
1029 content_tag('p', legend, :class => 'percent').html_safe
1030 1030 end
1031 1031
1032 1032 def checked_image(checked=true)
@@ -567,7 +567,7 class Project < ActiveRecord::Base
567 567 total / self_and_descendants.count
568 568 else
569 569 if versions.count > 0
570 total = versions.collect(&:completed_pourcent).sum
570 total = versions.collect(&:completed_percent).sum
571 571
572 572 total / versions.count
573 573 else
@@ -97,10 +97,10 class Version < ActiveRecord::Base
97 97 end
98 98
99 99 def behind_schedule?
100 if completed_pourcent == 100
100 if completed_percent == 100
101 101 return false
102 102 elsif due_date && start_date
103 done_date = start_date + ((due_date - start_date+1)* completed_pourcent/100).floor
103 done_date = start_date + ((due_date - start_date+1)* completed_percent/100).floor
104 104 return done_date <= Date.today
105 105 else
106 106 false # No issues so it's not late
@@ -109,7 +109,7 class Version < ActiveRecord::Base
109 109
110 110 # Returns the completion percentage of this version based on the amount of open/closed issues
111 111 # and the time spent on the open issues.
112 def completed_pourcent
112 def completed_percent
113 113 if issues_count == 0
114 114 0
115 115 elsif open_issues_count == 0
@@ -119,8 +119,14 class Version < ActiveRecord::Base
119 119 end
120 120 end
121 121
122 # TODO: remove in Redmine 3.0
123 def completed_pourcent
124 ActiveSupport::Deprecation.warn "Version#completed_pourcent is deprecated and will be removed in Redmine 3.0. Please use #completed_percent instead."
125 completed_percent
126 end
127
122 128 # Returns the percentage of issues that have been marked as 'closed'.
123 def closed_pourcent
129 def closed_percent
124 130 if issues_count == 0
125 131 0
126 132 else
@@ -128,6 +134,12 class Version < ActiveRecord::Base
128 134 end
129 135 end
130 136
137 # TODO: remove in Redmine 3.0
138 def closed_pourcent
139 ActiveSupport::Deprecation.warn "Version#closed_pourcent is deprecated and will be removed in Redmine 3.0. Please use #closed_percent instead."
140 closed_percent
141 end
142
131 143 # Returns true if the version is overdue: due date reached and some open issues
132 144 def overdue?
133 145 effective_date && (effective_date < Date.today) && (open_issues_count > 0)
@@ -16,7 +16,7
16 16 <% end %>
17 17
18 18 <% if version.issues_count > 0 %>
19 <%= progress_bar([version.closed_pourcent, version.completed_pourcent], :width => '40em', :legend => ('%0.0f%' % version.completed_pourcent)) %>
19 <%= progress_bar([version.closed_percent, version.completed_percent], :width => '40em', :legend => ('%0.0f%' % version.completed_percent)) %>
20 20 <p class="progress-info">
21 21 <%= link_to(l(:label_x_issues, :count => version.issues_count),
22 22 project_issues_path(version.project, :status_id => '*', :fixed_version_id => version, :set_filter => 1)) %>
@@ -307,9 +307,9 module Redmine
307 307 options[:zoom] ||= 1
308 308 options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom]
309 309 coords = coordinates(version.start_date,
310 version.due_date, version.completed_pourcent,
310 version.due_date, version.completed_percent,
311 311 options[:zoom])
312 label = "#{h version} #{h version.completed_pourcent.to_i.to_s}%"
312 label = "#{h version} #{h version.completed_percent.to_i.to_s}%"
313 313 label = h("#{version.project} -") + label unless @project && @project == version.project
314 314 case options[:format]
315 315 when :html
@@ -702,7 +702,7 table.progress td { height: 1em; }
702 702 table.progress td.closed { background: #BAE0BA none repeat scroll 0%; }
703 703 table.progress td.done { background: #D3EDD3 none repeat scroll 0%; }
704 704 table.progress td.todo { background: #eee none repeat scroll 0%; }
705 p.pourcent {font-size: 80%;}
705 p.percent {font-size: 80%;}
706 706 p.progress-info {clear: left; font-size: 80%; margin-top:-4px; color:#777;}
707 707
708 708 #roadmap table.progress td { height: 1.2em; }
@@ -46,8 +46,8 class VersionTest < ActiveSupport::TestCase
46 46 def test_progress_should_be_0_with_no_assigned_issues
47 47 project = Project.find(1)
48 48 v = Version.create!(:project => project, :name => 'Progress')
49 assert_equal 0, v.completed_pourcent
50 assert_equal 0, v.closed_pourcent
49 assert_equal 0, v.completed_percent
50 assert_equal 0, v.closed_percent
51 51 end
52 52
53 53 def test_progress_should_be_0_with_unbegun_assigned_issues
@@ -55,8 +55,8 class VersionTest < ActiveSupport::TestCase
55 55 v = Version.create!(:project => project, :name => 'Progress')
56 56 add_issue(v)
57 57 add_issue(v, :done_ratio => 0)
58 assert_progress_equal 0, v.completed_pourcent
59 assert_progress_equal 0, v.closed_pourcent
58 assert_progress_equal 0, v.completed_percent
59 assert_progress_equal 0, v.closed_percent
60 60 end
61 61
62 62 def test_progress_should_be_100_with_closed_assigned_issues
@@ -67,8 +67,8 class VersionTest < ActiveSupport::TestCase
67 67 add_issue(v, :status => status, :done_ratio => 20)
68 68 add_issue(v, :status => status, :done_ratio => 70, :estimated_hours => 25)
69 69 add_issue(v, :status => status, :estimated_hours => 15)
70 assert_progress_equal 100.0, v.completed_pourcent
71 assert_progress_equal 100.0, v.closed_pourcent
70 assert_progress_equal 100.0, v.completed_percent
71 assert_progress_equal 100.0, v.closed_percent
72 72 end
73 73
74 74 def test_progress_should_consider_done_ratio_of_open_assigned_issues
@@ -77,8 +77,8 class VersionTest < ActiveSupport::TestCase
77 77 add_issue(v)
78 78 add_issue(v, :done_ratio => 20)
79 79 add_issue(v, :done_ratio => 70)
80 assert_progress_equal (0.0 + 20.0 + 70.0)/3, v.completed_pourcent
81 assert_progress_equal 0, v.closed_pourcent
80 assert_progress_equal (0.0 + 20.0 + 70.0)/3, v.completed_percent
81 assert_progress_equal 0, v.closed_percent
82 82 end
83 83
84 84 def test_progress_should_consider_closed_issues_as_completed
@@ -87,8 +87,8 class VersionTest < ActiveSupport::TestCase
87 87 add_issue(v)
88 88 add_issue(v, :done_ratio => 20)
89 89 add_issue(v, :status => IssueStatus.where(:is_closed => true).first)
90 assert_progress_equal (0.0 + 20.0 + 100.0)/3, v.completed_pourcent
91 assert_progress_equal (100.0)/3, v.closed_pourcent
90 assert_progress_equal (0.0 + 20.0 + 100.0)/3, v.completed_percent
91 assert_progress_equal (100.0)/3, v.closed_percent
92 92 end
93 93
94 94 def test_progress_should_consider_estimated_hours_to_weigth_issues
@@ -98,8 +98,8 class VersionTest < ActiveSupport::TestCase
98 98 add_issue(v, :estimated_hours => 20, :done_ratio => 30)
99 99 add_issue(v, :estimated_hours => 40, :done_ratio => 10)
100 100 add_issue(v, :estimated_hours => 25, :status => IssueStatus.where(:is_closed => true).first)
101 assert_progress_equal (10.0*0 + 20.0*0.3 + 40*0.1 + 25.0*1)/95.0*100, v.completed_pourcent
102 assert_progress_equal 25.0/95.0*100, v.closed_pourcent
101 assert_progress_equal (10.0*0 + 20.0*0.3 + 40*0.1 + 25.0*1)/95.0*100, v.completed_percent
102 assert_progress_equal 25.0/95.0*100, v.closed_percent
103 103 end
104 104
105 105 def test_progress_should_consider_average_estimated_hours_to_weigth_unestimated_issues
@@ -109,8 +109,8 class VersionTest < ActiveSupport::TestCase
109 109 add_issue(v, :status => IssueStatus.where(:is_closed => true).first)
110 110 add_issue(v, :estimated_hours => 10, :done_ratio => 30)
111 111 add_issue(v, :estimated_hours => 40, :done_ratio => 10)
112 assert_progress_equal (25.0*0.2 + 25.0*1 + 10.0*0.3 + 40.0*0.1)/100.0*100, v.completed_pourcent
113 assert_progress_equal 25.0/100.0*100, v.closed_pourcent
112 assert_progress_equal (25.0*0.2 + 25.0*1 + 10.0*0.3 + 40.0*0.1)/100.0*100, v.completed_percent
113 assert_progress_equal 25.0/100.0*100, v.closed_percent
114 114 end
115 115
116 116 def test_should_sort_scheduled_then_unscheduled_versions
@@ -152,7 +152,7 class VersionTest < ActiveSupport::TestCase
152 152 @version.update_attribute(:effective_date, 7.days.from_now.to_date)
153 153 add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
154 154 add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
155 assert_equal 60, @version.completed_pourcent
155 assert_equal 60, @version.completed_percent
156 156 assert_equal false, @version.behind_schedule?
157 157 end
158 158
@@ -160,7 +160,7 class VersionTest < ActiveSupport::TestCase
160 160 @version.update_attribute(:effective_date, 7.days.from_now.to_date)
161 161 add_issue(@version, :start_date => 7.days.ago, :done_ratio => 60) # 14 day span, 60% done, 50% time left
162 162 add_issue(@version, :start_date => 7.days.ago, :done_ratio => 20) # 14 day span, 20% done, 50% time left
163 assert_equal 40, @version.completed_pourcent
163 assert_equal 40, @version.completed_percent
164 164 assert_equal true, @version.behind_schedule?
165 165 end
166 166
@@ -168,7 +168,7 class VersionTest < ActiveSupport::TestCase
168 168 @version.update_attribute(:effective_date, 7.days.from_now.to_date)
169 169 add_issue(@version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
170 170 add_issue(@version, :start_date => 14.days.ago, :done_ratio => 100, :status => IssueStatus.find(5)) # 7 day span
171 assert_equal 100, @version.completed_pourcent
171 assert_equal 100, @version.completed_percent
172 172 assert_equal false, @version.behind_schedule?
173 173 end
174 174 end
General Comments 0
You need to be logged in to leave comments. Login now