jam-cloud/web/app/views/api_lesson_sessions/show.rabl

61 lines
2.4 KiB
Ruby

object @lesson_session
attributes :id, :lesson_booking_id, :lesson_type, :duration, :price, :teacher_complete, :student_complete,
:status, :student_canceled, :teacher_canceled, :student_canceled_at, :teacher_canceled_at, :student_canceled_reason,
:teacher_canceled_reason, :status, :success, :teacher_unread_messages, :student_unread_messages, :is_active?, :recurring,
:analysed, :school_on_school?, :no_school_on_school_payment?, :payment_if_school_on_school?, :teacher_id, :student_id, :pretty_scheduled_start, :scheduled_start, :teacher_short_canceled,
:best_display_time, :remaining_roll_forward_amount_in_cents
node do |lesson_session|
{
analysis: lesson_session.analysis_json
}
end
child(:lesson_booking => :lesson_booking) {
attributes :card_presumed_ok, :test_drive_package_choice_id, :no_slots, :is_countered?
}
child(:counter_slot => :counter_slot) {
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :pretty_scheduled_start, :message, :pretty_start_time, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package, :is_recurring?
node :pretty_scheduled_start_with_timezone do |slot|
pretty_scheduled_start_slot(slot, true)
end
}
child(:music_session => :music_session) {
attributes :id, :music_session_id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat,
:band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :play_count, :scheduled_duration,
:language, :recurring_mode, :language_description, :scheduled_start_date, :access_description, :timezone, :timezone_id, :timezone_description,
:musician_access_description, :fan_access_description, :session_removed_at, :legal_policy, :open_rsvps, :is_unstructured_rsvp?
node :scheduled_start_date do |session|
scheduled_start_date(session)
end
node :scheduled_start do |history|
history.scheduled_start_time.strftime("%a %e %B %Y %H:%M:%S") if history.scheduled_start
end
node :pretty_scheduled_start_with_timezone do |session|
pretty_scheduled_start(session, true, true)
end
node :pretty_scheduled_start_short do|session|
pretty_scheduled_start(session, false)
end
}
node(:teacher) do |lesson_session|
partial "api_users/show", object: lesson_session.teacher
end
node(:student) do |lesson_session|
partial "api_users/show", object: lesson_session.student
end