]> source.dussan.org Git - redmine.git/commitdiff
gantt: simplify week day logic in to_image() at lib/redmine/helpers/gantt.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 27 May 2020 02:24:56 +0000 (02:24 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 27 May 2020 02:24:56 +0000 (02:24 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19796 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/helpers/gantt.rb

index cb3d519d44047a8413d45ed4d409e1dd2c771315..6bd9fc23c05c4743ee0225f2465f60f453b70bbd 100644 (file)
@@ -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