From: Toshi MARUYAMA Date: Wed, 27 May 2020 02:24:46 +0000 (+0000) Subject: gantt: simplify week day logic of view X-Git-Tag: 4.2.0~994 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8d04032cae2ab3529d35265e07fbd10d83e4044b;p=redmine.git gantt: simplify week day logic of view git-svn-id: http://svn.redmine.org/redmine/trunk@19795 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 8265ccc9d..1321acdd8 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -326,9 +326,8 @@ left = 0 height = g_height + header_height - 1 top = (show_day_num ? 55 : 37) - wday = @gantt.date_from.cwday %> - <% (@gantt.date_to - @gantt.date_from + 1).to_i.times do %> + <% (@gantt.date_from..@gantt.date_to).each do |g_date| %> <% width = zoom - 1 style = "" @@ -338,15 +337,13 @@ style += "height: #{height}px;" style += "font-size:0.7em;" clss = "gantt_hdr" - clss << " nwday" if @gantt.non_working_week_days.include?(wday) + clss << " nwday" if @gantt.non_working_week_days.include?(g_date.cwday) %> <%= content_tag(:div, :style => style, :class => clss) do %> - <%= day_letter(wday) %> + <%= day_letter(g_date.cwday) %> <% end %> <% left = left + width + 1 - wday = wday + 1 - wday = 1 if wday > 7 %> <% end %> <% end %>