2021-04-29 16:29:35 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-06-28 14:59:51 +02:00
|
|
|
json.partial! 'api/reservations/reservation', reservation: @reservation
|
2016-03-23 18:39:41 +01:00
|
|
|
json.user do
|
|
|
|
json.id @reservation.user.id
|
2019-06-04 16:50:23 +02:00
|
|
|
if @reservation.user.subscribed_plan
|
|
|
|
json.subscribed_plan do
|
|
|
|
json.partial! 'api/shared/plan', plan: @reservation.user.subscribed_plan
|
|
|
|
end
|
|
|
|
end
|
2016-03-23 18:39:41 +01:00
|
|
|
json.training_credits @reservation.user.training_credits do |tc|
|
|
|
|
json.training_id tc.creditable_id
|
|
|
|
end
|
|
|
|
json.machine_credits @reservation.user.machine_credits do |mc|
|
|
|
|
json.machine_id mc.creditable_id
|
2019-06-04 16:50:23 +02:00
|
|
|
json.hours_used mc.users_credits.find_by(user_id: @reservation.statistic_profile.user_id).hours_used
|
2016-03-23 18:39:41 +01:00
|
|
|
end
|
|
|
|
end
|