Skip to content

Commit 6def16f

Browse files
author
Andreas Treubert
committed
ical feature
1 parent 8550ba3 commit 6def16f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/controllers/calendar_controller.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,13 @@ def export
8282
ical = Vpim::Icalendar.create({ 'METHOD' => 'REQUEST', 'CHARSET' => 'UTF-8' })
8383
time_start = params['time_start']
8484
time_end = params['time_end']
85-
Issue.where(["(issues.start_date IS NOT NULL OR issues.due_date IS NOT NULL) AND ((issues.start_date >= ? AND issues.start_date <= ?) OR (issues.due_date >= ? AND issues.due_date <= ?))", time_start, time_end, time_start, time_end]).each do |issue|
85+
time_start = Date.today.to_s if time_start.nil?
86+
time_end = (Date.today + 2.years).to_s if time_end.nil?
87+
issues = Issue.where(["(issues.start_date IS NOT NULL OR issues.due_date IS NOT NULL) AND ((issues.start_date >= ? AND issues.start_date <= ?) OR (issues.due_date >= ? AND issues.due_date <= ?))", time_start, time_end, time_start, time_end])
88+
unless params['assigned_to'].blank?
89+
issues = issues.where(["(issues.assigned_to_id = ? OR issues.assigned_to_id IN (SELECT user_id FROM groups_users WHERE group_id = ?))",params['assigned_to'],params['assigned_to']])
90+
end
91+
issues.each do |issue|
8692
ical.add_event do |e|
8793
ticket_time = TicketTime.where({:issue_id => issue.id}).first rescue nil
8894
tbegin = ticket_time.time_begin.strftime(" %H:%M") rescue ''

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
name 'Mega Calendar plugin'
104104
author 'Andreas Treubert'
105105
description 'Better calendar for redmine'
106-
version '1.9.9'
106+
version '2.0.0'
107107
url 'https://github.com/berti92/mega_calendar'
108108
author_url 'https://github.com/berti92'
109109
requires_redmine :version_or_higher => '5.1.1'

0 commit comments

Comments
 (0)