diff --git a/app/models/plan.rb b/app/models/plan.rb index b32f3f6f18..d47cb82814 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -991,14 +991,16 @@ def self.eager_load(id) end def self.load_for_phase(id, phase_id) - Plan.includes( - [template: [ - {phases: {sections: {questions: [{answers: :notes}, :annotations, :question_format, :themes]}}}, - {customizations: :org}, - :org - ], - plans_guidance_groups: {guidance_group: {guidances: :themes}} - ]).where(id: id, phases: { id: phase_id }).first +# Plan.includes( +# [template: [ +# {phases: {sections: {questions: [{answers: :notes}, :annotations, :question_format, :themes]}}}, +# {customizations: :org}, +# :org +# ], +# plans_guidance_groups: {guidance_group: {guidances: :themes}} +# ]).where(id: id, phases: { id: phase_id }).first + + Plan.joins(:phases).where('plans.id = ? AND phases.id = ?', id, phase_id).includes(:template, :sections, :questions, :answers, :notes).first end