[feat]Implement FullCalendarFormatter#event_schedules_to_resources; Add tests
This commit is contained in:
parent
abe2ea9bb3
commit
4b83ae8be7
2 changed files with 46 additions and 8 deletions
|
|
@ -3,14 +3,28 @@ class FullCalendarFormatter
|
|||
rooms.map { |room| room_to_resource(room) }.to_json
|
||||
end
|
||||
|
||||
def self.event_schedules_to_resources(event_schedules); end
|
||||
def self.event_schedules_to_resources(event_schedules)
|
||||
event_schedules.map { |event_schedule| event_schedule_to_resource(event_schedule) }.to_json
|
||||
end
|
||||
|
||||
private_class_method
|
||||
class << self
|
||||
private
|
||||
|
||||
def self.room_to_resource(room)
|
||||
{
|
||||
id: room.guid,
|
||||
title: room.name
|
||||
}
|
||||
def room_to_resource(room)
|
||||
{
|
||||
id: room.guid,
|
||||
title: room.name
|
||||
}
|
||||
end
|
||||
|
||||
def event_schedule_to_resource(event_schedule)
|
||||
{
|
||||
id: event_schedule.event.guid,
|
||||
title: event_schedule.event.title,
|
||||
start: event_schedule.start_time,
|
||||
end: event_schedule.end_time,
|
||||
source: event_schedule.room.guid
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue