##// END OF EJS Templates
Display project names in cross-project gantt PNG (#5904)....
Jean-Philippe Lang -
r3771:701d2eaeacdf
parent child
Show More
@@ -1,45 +1,45
1 class GanttsController < ApplicationController
1 class GanttsController < ApplicationController
2 before_filter :find_optional_project
2 before_filter :find_optional_project
3
3
4 rescue_from Query::StatementInvalid, :with => :query_statement_invalid
4 rescue_from Query::StatementInvalid, :with => :query_statement_invalid
5
5
6 helper :issues
6 helper :issues
7 helper :projects
7 helper :projects
8 helper :queries
8 helper :queries
9 include QueriesHelper
9 include QueriesHelper
10 helper :sort
10 helper :sort
11 include SortHelper
11 include SortHelper
12 include Redmine::Export::PDF
12 include Redmine::Export::PDF
13
13
14 def show
14 def show
15 @gantt = Redmine::Helpers::Gantt.new(params)
15 @gantt = Redmine::Helpers::Gantt.new(params)
16 retrieve_query
16 retrieve_query
17 @query.group_by = nil
17 @query.group_by = nil
18 if @query.valid?
18 if @query.valid?
19 events = []
19 events = []
20 # Issues that have start and due dates
20 # Issues that have start and due dates
21 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
21 events += @query.issues(:include => [:tracker, :assigned_to, :priority],
22 :order => "start_date, due_date",
22 :order => "start_date, due_date",
23 :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
23 :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
24 )
24 )
25 # Issues that don't have a due date but that are assigned to a version with a date
25 # Issues that don't have a due date but that are assigned to a version with a date
26 events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
26 events += @query.issues(:include => [:tracker, :assigned_to, :priority, :fixed_version],
27 :order => "start_date, effective_date",
27 :order => "start_date, effective_date",
28 :conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
28 :conditions => ["(((start_date>=? and start_date<=?) or (effective_date>=? and effective_date<=?) or (start_date<? and effective_date>?)) and start_date is not null and due_date is null and effective_date is not null)", @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to, @gantt.date_from, @gantt.date_to]
29 )
29 )
30 # Versions
30 # Versions
31 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
31 events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @gantt.date_from, @gantt.date_to])
32
32
33 @gantt.events = events
33 @gantt.events = events
34 end
34 end
35
35
36 basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
36 basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
37
37
38 respond_to do |format|
38 respond_to do |format|
39 format.html { render :action => "show", :layout => !request.xhr? }
39 format.html { render :action => "show", :layout => !request.xhr? }
40 format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
40 format.png { send_data(@gantt.to_image(@project), :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
41 format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
41 format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
42 end
42 end
43 end
43 end
44
44
45 end
45 end
@@ -1,274 +1,281
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 module Redmine
18 module Redmine
19 module Helpers
19 module Helpers
20 # Simple class to handle gantt chart data
20 # Simple class to handle gantt chart data
21 class Gantt
21 class Gantt
22 attr_reader :year_from, :month_from, :date_from, :date_to, :zoom, :months, :events
22 attr_reader :year_from, :month_from, :date_from, :date_to, :zoom, :months, :events
23
23
24 def initialize(options={})
24 def initialize(options={})
25 options = options.dup
25 options = options.dup
26 @events = []
26 @events = []
27
27
28 if options[:year] && options[:year].to_i >0
28 if options[:year] && options[:year].to_i >0
29 @year_from = options[:year].to_i
29 @year_from = options[:year].to_i
30 if options[:month] && options[:month].to_i >=1 && options[:month].to_i <= 12
30 if options[:month] && options[:month].to_i >=1 && options[:month].to_i <= 12
31 @month_from = options[:month].to_i
31 @month_from = options[:month].to_i
32 else
32 else
33 @month_from = 1
33 @month_from = 1
34 end
34 end
35 else
35 else
36 @month_from ||= Date.today.month
36 @month_from ||= Date.today.month
37 @year_from ||= Date.today.year
37 @year_from ||= Date.today.year
38 end
38 end
39
39
40 zoom = (options[:zoom] || User.current.pref[:gantt_zoom]).to_i
40 zoom = (options[:zoom] || User.current.pref[:gantt_zoom]).to_i
41 @zoom = (zoom > 0 && zoom < 5) ? zoom : 2
41 @zoom = (zoom > 0 && zoom < 5) ? zoom : 2
42 months = (options[:months] || User.current.pref[:gantt_months]).to_i
42 months = (options[:months] || User.current.pref[:gantt_months]).to_i
43 @months = (months > 0 && months < 25) ? months : 6
43 @months = (months > 0 && months < 25) ? months : 6
44
44
45 # Save gantt parameters as user preference (zoom and months count)
45 # Save gantt parameters as user preference (zoom and months count)
46 if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months]))
46 if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months]))
47 User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months
47 User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months
48 User.current.preference.save
48 User.current.preference.save
49 end
49 end
50
50
51 @date_from = Date.civil(@year_from, @month_from, 1)
51 @date_from = Date.civil(@year_from, @month_from, 1)
52 @date_to = (@date_from >> @months) - 1
52 @date_to = (@date_from >> @months) - 1
53 end
53 end
54
54
55
55
56 def events=(e)
56 def events=(e)
57 @events = e
57 @events = e
58 # Adds all ancestors
58 # Adds all ancestors
59 root_ids = e.select {|i| i.is_a?(Issue) && i.parent_id? }.collect(&:root_id).uniq
59 root_ids = e.select {|i| i.is_a?(Issue) && i.parent_id? }.collect(&:root_id).uniq
60 if root_ids.any?
60 if root_ids.any?
61 # Retrieves all nodes
61 # Retrieves all nodes
62 parents = Issue.find_all_by_root_id(root_ids, :conditions => ["rgt - lft > 1"])
62 parents = Issue.find_all_by_root_id(root_ids, :conditions => ["rgt - lft > 1"])
63 # Only add ancestors
63 # Only add ancestors
64 @events += parents.select {|p| @events.detect {|i| i.is_a?(Issue) && p.is_ancestor_of?(i)}}
64 @events += parents.select {|p| @events.detect {|i| i.is_a?(Issue) && p.is_ancestor_of?(i)}}
65 end
65 end
66 @events.uniq!
66 @events.uniq!
67 # Sort issues by hierarchy and start dates
67 # Sort issues by hierarchy and start dates
68 @events.sort! {|x,y|
68 @events.sort! {|x,y|
69 if x.is_a?(Issue) && y.is_a?(Issue)
69 if x.is_a?(Issue) && y.is_a?(Issue)
70 gantt_issue_compare(x, y, @events)
70 gantt_issue_compare(x, y, @events)
71 else
71 else
72 gantt_start_compare(x, y)
72 gantt_start_compare(x, y)
73 end
73 end
74 }
74 }
75 # Removes issues that have no start or end date
75 # Removes issues that have no start or end date
76 @events.reject! {|i| i.is_a?(Issue) && (i.start_date.nil? || i.due_before.nil?) }
76 @events.reject! {|i| i.is_a?(Issue) && (i.start_date.nil? || i.due_before.nil?) }
77 @events
77 @events
78 end
78 end
79
79
80 def params
80 def params
81 { :zoom => zoom, :year => year_from, :month => month_from, :months => months }
81 { :zoom => zoom, :year => year_from, :month => month_from, :months => months }
82 end
82 end
83
83
84 def params_previous
84 def params_previous
85 { :year => (date_from << months).year, :month => (date_from << months).month, :zoom => zoom, :months => months }
85 { :year => (date_from << months).year, :month => (date_from << months).month, :zoom => zoom, :months => months }
86 end
86 end
87
87
88 def params_next
88 def params_next
89 { :year => (date_from >> months).year, :month => (date_from >> months).month, :zoom => zoom, :months => months }
89 { :year => (date_from >> months).year, :month => (date_from >> months).month, :zoom => zoom, :months => months }
90 end
90 end
91
91
92 # Generates a gantt image
92 # Generates a gantt image
93 # Only defined if RMagick is avalaible
93 # Only defined if RMagick is avalaible
94 def to_image(format='PNG')
94 def to_image(project, format='PNG')
95 date_to = (@date_from >> @months)-1
95 date_to = (@date_from >> @months)-1
96 show_weeks = @zoom > 1
96 show_weeks = @zoom > 1
97 show_days = @zoom > 2
97 show_days = @zoom > 2
98
98
99 subject_width = 320
99 subject_width = 400
100 header_heigth = 18
100 header_heigth = 18
101 # width of one day in pixels
101 # width of one day in pixels
102 zoom = @zoom*2
102 zoom = @zoom*2
103 g_width = (@date_to - @date_from + 1)*zoom
103 g_width = (@date_to - @date_from + 1)*zoom
104 g_height = 20 * events.length + 20
104 g_height = 20 * events.length + 20
105 headers_heigth = (show_weeks ? 2*header_heigth : header_heigth)
105 headers_heigth = (show_weeks ? 2*header_heigth : header_heigth)
106 height = g_height + headers_heigth
106 height = g_height + headers_heigth
107
107
108 imgl = Magick::ImageList.new
108 imgl = Magick::ImageList.new
109 imgl.new_image(subject_width+g_width+1, height)
109 imgl.new_image(subject_width+g_width+1, height)
110 gc = Magick::Draw.new
110 gc = Magick::Draw.new
111
111
112 # Subjects
112 # Subjects
113 top = headers_heigth + 20
113 top = headers_heigth + 20
114 gc.fill('black')
114 gc.fill('black')
115 gc.stroke('transparent')
115 gc.stroke('transparent')
116 gc.stroke_width(1)
116 gc.stroke_width(1)
117 events.each do |i|
117 events.each do |i|
118 gc.text(4, top + 2, (i.is_a?(Issue) ? i.subject : i.name))
118 text = ""
119 if i.is_a? Issue
120 text = "#{i.tracker} #{i.id}: #{i.subject}"
121 else
122 text = i.name
123 end
124 text = "#{i.project} - #{text}" unless project && project == i.project
125 gc.text(4, top + 2, text)
119 top = top + 20
126 top = top + 20
120 end
127 end
121
128
122 # Months headers
129 # Months headers
123 month_f = @date_from
130 month_f = @date_from
124 left = subject_width
131 left = subject_width
125 @months.times do
132 @months.times do
126 width = ((month_f >> 1) - month_f) * zoom
133 width = ((month_f >> 1) - month_f) * zoom
127 gc.fill('white')
134 gc.fill('white')
128 gc.stroke('grey')
135 gc.stroke('grey')
129 gc.stroke_width(1)
136 gc.stroke_width(1)
130 gc.rectangle(left, 0, left + width, height)
137 gc.rectangle(left, 0, left + width, height)
131 gc.fill('black')
138 gc.fill('black')
132 gc.stroke('transparent')
139 gc.stroke('transparent')
133 gc.stroke_width(1)
140 gc.stroke_width(1)
134 gc.text(left.round + 8, 14, "#{month_f.year}-#{month_f.month}")
141 gc.text(left.round + 8, 14, "#{month_f.year}-#{month_f.month}")
135 left = left + width
142 left = left + width
136 month_f = month_f >> 1
143 month_f = month_f >> 1
137 end
144 end
138
145
139 # Weeks headers
146 # Weeks headers
140 if show_weeks
147 if show_weeks
141 left = subject_width
148 left = subject_width
142 height = header_heigth
149 height = header_heigth
143 if @date_from.cwday == 1
150 if @date_from.cwday == 1
144 # date_from is monday
151 # date_from is monday
145 week_f = date_from
152 week_f = date_from
146 else
153 else
147 # find next monday after date_from
154 # find next monday after date_from
148 week_f = @date_from + (7 - @date_from.cwday + 1)
155 week_f = @date_from + (7 - @date_from.cwday + 1)
149 width = (7 - @date_from.cwday + 1) * zoom
156 width = (7 - @date_from.cwday + 1) * zoom
150 gc.fill('white')
157 gc.fill('white')
151 gc.stroke('grey')
158 gc.stroke('grey')
152 gc.stroke_width(1)
159 gc.stroke_width(1)
153 gc.rectangle(left, header_heigth, left + width, 2*header_heigth + g_height-1)
160 gc.rectangle(left, header_heigth, left + width, 2*header_heigth + g_height-1)
154 left = left + width
161 left = left + width
155 end
162 end
156 while week_f <= date_to
163 while week_f <= date_to
157 width = (week_f + 6 <= date_to) ? 7 * zoom : (date_to - week_f + 1) * zoom
164 width = (week_f + 6 <= date_to) ? 7 * zoom : (date_to - week_f + 1) * zoom
158 gc.fill('white')
165 gc.fill('white')
159 gc.stroke('grey')
166 gc.stroke('grey')
160 gc.stroke_width(1)
167 gc.stroke_width(1)
161 gc.rectangle(left.round, header_heigth, left.round + width, 2*header_heigth + g_height-1)
168 gc.rectangle(left.round, header_heigth, left.round + width, 2*header_heigth + g_height-1)
162 gc.fill('black')
169 gc.fill('black')
163 gc.stroke('transparent')
170 gc.stroke('transparent')
164 gc.stroke_width(1)
171 gc.stroke_width(1)
165 gc.text(left.round + 2, header_heigth + 14, week_f.cweek.to_s)
172 gc.text(left.round + 2, header_heigth + 14, week_f.cweek.to_s)
166 left = left + width
173 left = left + width
167 week_f = week_f+7
174 week_f = week_f+7
168 end
175 end
169 end
176 end
170
177
171 # Days details (week-end in grey)
178 # Days details (week-end in grey)
172 if show_days
179 if show_days
173 left = subject_width
180 left = subject_width
174 height = g_height + header_heigth - 1
181 height = g_height + header_heigth - 1
175 wday = @date_from.cwday
182 wday = @date_from.cwday
176 (date_to - @date_from + 1).to_i.times do
183 (date_to - @date_from + 1).to_i.times do
177 width = zoom
184 width = zoom
178 gc.fill(wday == 6 || wday == 7 ? '#eee' : 'white')
185 gc.fill(wday == 6 || wday == 7 ? '#eee' : 'white')
179 gc.stroke('grey')
186 gc.stroke('grey')
180 gc.stroke_width(1)
187 gc.stroke_width(1)
181 gc.rectangle(left, 2*header_heigth, left + width, 2*header_heigth + g_height-1)
188 gc.rectangle(left, 2*header_heigth, left + width, 2*header_heigth + g_height-1)
182 left = left + width
189 left = left + width
183 wday = wday + 1
190 wday = wday + 1
184 wday = 1 if wday > 7
191 wday = 1 if wday > 7
185 end
192 end
186 end
193 end
187
194
188 # border
195 # border
189 gc.fill('transparent')
196 gc.fill('transparent')
190 gc.stroke('grey')
197 gc.stroke('grey')
191 gc.stroke_width(1)
198 gc.stroke_width(1)
192 gc.rectangle(0, 0, subject_width+g_width, headers_heigth)
199 gc.rectangle(0, 0, subject_width+g_width, headers_heigth)
193 gc.stroke('black')
200 gc.stroke('black')
194 gc.rectangle(0, 0, subject_width+g_width, g_height+ headers_heigth-1)
201 gc.rectangle(0, 0, subject_width+g_width, g_height+ headers_heigth-1)
195
202
196 # content
203 # content
197 top = headers_heigth + 20
204 top = headers_heigth + 20
198 gc.stroke('transparent')
205 gc.stroke('transparent')
199 events.each do |i|
206 events.each do |i|
200 if i.is_a?(Issue)
207 if i.is_a?(Issue)
201 i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
208 i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
202 i_end_date = (i.due_before <= date_to ? i.due_before : date_to )
209 i_end_date = (i.due_before <= date_to ? i.due_before : date_to )
203 i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor
210 i_done_date = i.start_date + ((i.due_before - i.start_date+1)*i.done_ratio/100).floor
204 i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
211 i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
205 i_done_date = (i_done_date >= date_to ? date_to : i_done_date )
212 i_done_date = (i_done_date >= date_to ? date_to : i_done_date )
206 i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
213 i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
207
214
208 i_left = subject_width + ((i_start_date - @date_from)*zoom).floor
215 i_left = subject_width + ((i_start_date - @date_from)*zoom).floor
209 i_width = ((i_end_date - i_start_date + 1)*zoom).floor # total width of the issue
216 i_width = ((i_end_date - i_start_date + 1)*zoom).floor # total width of the issue
210 d_width = ((i_done_date - i_start_date)*zoom).floor # done width
217 d_width = ((i_done_date - i_start_date)*zoom).floor # done width
211 l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor : 0 # delay width
218 l_width = i_late_date ? ((i_late_date - i_start_date+1)*zoom).floor : 0 # delay width
212
219
213 gc.fill('grey')
220 gc.fill('grey')
214 gc.rectangle(i_left, top, i_left + i_width, top - 6)
221 gc.rectangle(i_left, top, i_left + i_width, top - 6)
215 gc.fill('red')
222 gc.fill('red')
216 gc.rectangle(i_left, top, i_left + l_width, top - 6) if l_width > 0
223 gc.rectangle(i_left, top, i_left + l_width, top - 6) if l_width > 0
217 gc.fill('blue')
224 gc.fill('blue')
218 gc.rectangle(i_left, top, i_left + d_width, top - 6) if d_width > 0
225 gc.rectangle(i_left, top, i_left + d_width, top - 6) if d_width > 0
219 gc.fill('black')
226 gc.fill('black')
220 gc.text(i_left + i_width + 5,top + 1, "#{i.status.name} #{i.done_ratio}%")
227 gc.text(i_left + i_width + 5,top + 1, "#{i.status.name} #{i.done_ratio}%")
221 else
228 else
222 i_left = subject_width + ((i.start_date - @date_from)*zoom).floor
229 i_left = subject_width + ((i.start_date - @date_from)*zoom).floor
223 gc.fill('green')
230 gc.fill('green')
224 gc.rectangle(i_left, top, i_left + 6, top - 6)
231 gc.rectangle(i_left, top, i_left + 6, top - 6)
225 gc.fill('black')
232 gc.fill('black')
226 gc.text(i_left + 11, top + 1, i.name)
233 gc.text(i_left + 11, top + 1, i.name)
227 end
234 end
228 top = top + 20
235 top = top + 20
229 end
236 end
230
237
231 # today red line
238 # today red line
232 if Date.today >= @date_from and Date.today <= date_to
239 if Date.today >= @date_from and Date.today <= date_to
233 gc.stroke('red')
240 gc.stroke('red')
234 x = (Date.today-@date_from+1)*zoom + subject_width
241 x = (Date.today-@date_from+1)*zoom + subject_width
235 gc.line(x, headers_heigth, x, headers_heigth + g_height-1)
242 gc.line(x, headers_heigth, x, headers_heigth + g_height-1)
236 end
243 end
237
244
238 gc.draw(imgl)
245 gc.draw(imgl)
239 imgl.format = format
246 imgl.format = format
240 imgl.to_blob
247 imgl.to_blob
241 end if Object.const_defined?(:Magick)
248 end if Object.const_defined?(:Magick)
242
249
243 private
250 private
244
251
245 def gantt_issue_compare(x, y, issues)
252 def gantt_issue_compare(x, y, issues)
246 if x.parent_id == y.parent_id
253 if x.parent_id == y.parent_id
247 gantt_start_compare(x, y)
254 gantt_start_compare(x, y)
248 elsif x.is_ancestor_of?(y)
255 elsif x.is_ancestor_of?(y)
249 -1
256 -1
250 elsif y.is_ancestor_of?(x)
257 elsif y.is_ancestor_of?(x)
251 1
258 1
252 else
259 else
253 ax = issues.select {|i| i.is_a?(Issue) && i.is_ancestor_of?(x) && !i.is_ancestor_of?(y) }.sort_by(&:lft).first
260 ax = issues.select {|i| i.is_a?(Issue) && i.is_ancestor_of?(x) && !i.is_ancestor_of?(y) }.sort_by(&:lft).first
254 ay = issues.select {|i| i.is_a?(Issue) && i.is_ancestor_of?(y) && !i.is_ancestor_of?(x) }.sort_by(&:lft).first
261 ay = issues.select {|i| i.is_a?(Issue) && i.is_ancestor_of?(y) && !i.is_ancestor_of?(x) }.sort_by(&:lft).first
255 if ax.nil? && ay.nil?
262 if ax.nil? && ay.nil?
256 gantt_start_compare(x, y)
263 gantt_start_compare(x, y)
257 else
264 else
258 gantt_issue_compare(ax || x, ay || y, issues)
265 gantt_issue_compare(ax || x, ay || y, issues)
259 end
266 end
260 end
267 end
261 end
268 end
262
269
263 def gantt_start_compare(x, y)
270 def gantt_start_compare(x, y)
264 if x.start_date.nil?
271 if x.start_date.nil?
265 -1
272 -1
266 elsif y.start_date.nil?
273 elsif y.start_date.nil?
267 1
274 1
268 else
275 else
269 x.start_date <=> y.start_date
276 x.start_date <=> y.start_date
270 end
277 end
271 end
278 end
272 end
279 end
273 end
280 end
274 end
281 end
General Comments 0
You need to be logged in to leave comments. Login now