2016-07-14 12:18:24 +02:00
|
|
|
json.extract! @training, :id, :name, :description, :machine_ids, :nb_total_places, :public_page
|
2016-07-13 18:15:14 +02:00
|
|
|
json.training_image @training.training_image.attachment.large.url if @training.training_image
|
|
|
|
json.availabilities @training.availabilities.order('start_at DESC') do |a|
|
2016-03-23 18:39:41 +01:00
|
|
|
json.id a.id
|
|
|
|
json.start_at a.start_at.iso8601
|
|
|
|
json.end_at a.end_at.iso8601
|
|
|
|
json.reservation_users a.slots.map do |slot|
|
|
|
|
json.id slot.reservation.user.id
|
|
|
|
json.full_name slot.reservation.user.profile.full_name
|
2016-06-15 12:01:09 +02:00
|
|
|
json.is_valid slot.reservation.user.trainings.include?(@training)
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
end
|