Skip to content

Commit

Permalink
ical feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Treubert committed Sep 12, 2024
1 parent 8550ba3 commit 6def16f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/controllers/calendar_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ def export
ical = Vpim::Icalendar.create({ 'METHOD' => 'REQUEST', 'CHARSET' => 'UTF-8' })
time_start = params['time_start']
time_end = params['time_end']
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|
time_start = Date.today.to_s if time_start.nil?
time_end = (Date.today + 2.years).to_s if time_end.nil?
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])
unless params['assigned_to'].blank?
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']])
end
issues.each do |issue|
ical.add_event do |e|
ticket_time = TicketTime.where({:issue_id => issue.id}).first rescue nil
tbegin = ticket_time.time_begin.strftime(" %H:%M") rescue ''
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
name 'Mega Calendar plugin'
author 'Andreas Treubert'
description 'Better calendar for redmine'
version '1.9.9'
version '2.0.0'
url 'https://github.com/berti92/mega_calendar'
author_url 'https://github.com/berti92'
requires_redmine :version_or_higher => '5.1.1'
Expand Down

0 comments on commit 6def16f

Please sign in to comment.