1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

gantt: simplify week day logic in to_image() at lib/redmine/helpers/gantt.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@19796 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2020-05-27 02:24:56 +00:00
parent 8d04032cae
commit 0f8df77744

View File

@ -446,18 +446,15 @@ module Redmine
if show_days if show_days
left = subject_width left = subject_width
height = g_height + header_height - 1 height = g_height + header_height - 1
wday = @date_from.cwday (@date_from..date_to).each do |g_date|
(date_to - @date_from + 1).to_i.times do
width = zoom width = zoom
gc.fill(non_working_week_days.include?(wday) ? '#eee' : 'white') gc.fill(non_working_week_days.include?(g_date.cwday) ? '#eee' : 'white')
gc.stroke('#ddd') gc.stroke('#ddd')
gc.strokewidth(1) gc.strokewidth(1)
gc.draw('rectangle %d,%d %d,%d' % [ gc.draw('rectangle %d,%d %d,%d' % [
left, 2 * header_height, left + width, 2 * header_height + g_height - 1 left, 2 * header_height, left + width, 2 * header_height + g_height - 1
]) ])
left = left + width left = left + width
wday = wday + 1
wday = 1 if wday > 7
end end
end end
# border # border