Skip to content

Commit

Permalink
add appointment group preloads
Browse files Browse the repository at this point in the history
refs CNVS-4561

test plan
-make sure scheduler works as before

Change-Id: Ie310af56f716aea1fadac9a2b0ad41481b38ed77
Reviewed-on: https://gerrit.instructure.com/19329
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
  • Loading branch information
JoelHough authored and zachpendleton committed Apr 4, 2013
1 parent 8aefb86 commit 0cc6857
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions app/controllers/appointment_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,23 @@ def index
self,
api_v1_appointment_groups_url(:scope => params[:scope])
)
AppointmentGroup.send(:preload_associations, groups, :appointments) if params[:include]
render :json => groups.map{ |group| appointment_group_json(group, @current_user, session, :include => params[:include]) }
if params[:include]
AppointmentGroup.send(:preload_associations, groups,
[{:appointments =>
[:parent_event,
{:context =>
[{:appointment_group_contexts => :context},
:appointment_group_sub_contexts]},
{:child_events =>
[:parent_event,
:context,
{:child_events =>
[:parent_event,
:context]}]}]},
{:appointment_group_contexts => :context},
:appointment_group_sub_contexts])
end
render :json => groups.map{ |group| appointment_group_json(group, @current_user, session, :include => params[:include]) }
end

# @API Create an appointment group
Expand Down

0 comments on commit 0cc6857

Please sign in to comment.