Skip to content

Commit 1f136d0

Browse files
committed
ical events
1 parent b9f02d5 commit 1f136d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/services/reservation_calendar_service.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# Service class for generating iCalendar files for reservations by type
44
class ReservationCalendarService
5+
require 'icalendar'
6+
require 'icalendar/tzinfo'
7+
58
ALLOWED_TYPES = %w[Machine Training Event Space].freeze
69

710
def initialize(params)
@@ -51,14 +54,14 @@ def slot_icalendar_event(cal)
5154
reservations = load_reservations
5255

5356
reservations.find_each do |reservation|
54-
reservation.slots_reservations.each do |slots_reservation|
57+
reservation.slots_reservations.where(canceled_at: nil).each do |slots_reservation|
5558
cal.event do |e|
5659
e.dtstart = slots_reservation.slot.start_at
5760
e.dtend = slots_reservation.slot.end_at
5861
e.summary = slots_reservation.reservation.reservable.name
5962
e.description = user_name(slots_reservation.reservation)
6063
e.uid = "#{reservable_type}-#{slots_reservation.reservation.reservable.id}-#{slots_reservation.slot.start_at.to_i}@fabmanager"
61-
e.status = slots_reservation.canceled_at ? 'CANCELLED' : 'CONFIRMED'
64+
# e.status = slots_reservation.canceled_at ? 'CANCELLED' : 'CONFIRMED'
6265
end
6366
end
6467
# reservation.grouped_slots.each do |_date, daily_groups|

0 commit comments

Comments
 (0)