From: Toshi MARUYAMA Date: Wed, 27 May 2020 02:24:56 +0000 (+0000) Subject: gantt: simplify week day logic in to_image() at lib/redmine/helpers/gantt.rb X-Git-Tag: 4.2.0~993 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f8df77744cee4e29acbc8642db81227bcf7ef28;p=redmine.git 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 --- diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index cb3d519d4..6bd9fc23c 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -446,18 +446,15 @@ module Redmine if show_days left = subject_width height = g_height + header_height - 1 - wday = @date_from.cwday - (date_to - @date_from + 1).to_i.times do + (@date_from..date_to).each do |g_date| 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.strokewidth(1) gc.draw('rectangle %d,%d %d,%d' % [ left, 2 * header_height, left + width, 2 * header_height + g_height - 1 ]) left = left + width - wday = wday + 1 - wday = 1 if wday > 7 end end # border