summaryrefslogtreecommitdiffstats
path: root/lib/redmine/helpers
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-05-27 02:25:06 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-05-27 02:25:06 +0000
commit7055dcd7678d926b80d5b0e66b0e16d827920339 (patch)
treec0c4c0ac223da3d794b1a4f9165fde8e053f0555 /lib/redmine/helpers
parent0f8df77744cee4e29acbc8642db81227bcf7ef28 (diff)
downloadredmine-7055dcd7678d926b80d5b0e66b0e16d827920339.tar.gz
redmine-7055dcd7678d926b80d5b0e66b0e16d827920339.zip
gantt: simplify week day logic in to_pdf() at lib/redmine/helpers/gantt.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@19797 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/helpers')
-rw-r--r--lib/redmine/helpers/gantt.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 6bd9fc23c..4ea779d16 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -563,35 +563,29 @@ module Redmine
left = subject_width
height = header_height
day_num = self.date_from
- wday = self.date_from.cwday
pdf.SetFontStyle('B', 7)
- (self.date_to - self.date_from + 1).to_i.times do
+ (self.date_from..self.date_to).each do |g_date|
width = zoom
pdf.SetY(y_start + header_height * 2)
pdf.SetX(left)
- pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0)
+ pdf.SetTextColor(non_working_week_days.include?(g_date.cwday) ? 150 : 0)
pdf.RDMCell(width, height, day_num.day.to_s, "LTR", 0, "C")
left = left + width
day_num = day_num + 1
- wday = wday + 1
- wday = 1 if wday > 7
end
end
# Days headers
if show_days
left = subject_width
height = header_height
- wday = self.date_from.cwday
pdf.SetFontStyle('B', 7)
- (self.date_to - self.date_from + 1).to_i.times do
+ (self.date_from..self.date_to).each do |g_date|
width = zoom
pdf.SetY(y_start + header_height * (show_day_num ? 3 : 2))
pdf.SetX(left)
- pdf.SetTextColor(non_working_week_days.include?(wday) ? 150 : 0)
- pdf.RDMCell(width, height, day_name(wday).first, "LTR", 0, "C")
+ pdf.SetTextColor(non_working_week_days.include?(g_date.cwday) ? 150 : 0)
+ pdf.RDMCell(width, height, day_name(g_date.cwday).first, "LTR", 0, "C")
left = left + width
- wday = wday + 1
- wday = 1 if wday > 7
end
end
pdf.SetY(y_start)