diff --git a/app/models/phase.rb b/app/models/phase.rb index 0e0fce6..2612f3e 100644 --- a/app/models/phase.rb +++ b/app/models/phase.rb @@ -12,7 +12,6 @@ # Associations belongs_to :template has_many :sections, -> { order(:number => :asc) }, dependent: :destroy - has_many :questions, through: :sections ## # Possibly needed for active_admin diff --git a/app/views/plans/_overview_details.html.erb b/app/views/plans/_overview_details.html.erb index 6949ebf..b406da2 100644 --- a/app/views/plans/_overview_details.html.erb +++ b/app/views/plans/_overview_details.html.erb @@ -32,7 +32,8 @@
<%= _("%{phase_title} (%{sections_size} %{sections}, %{questions_size} %{questions})") % { :phase_title => p.title, :sections_size => p.sections.size, :sections => n_('section', 'sections', p.sections.size), - :questions_size => p.questions.size, :questions => n_('question', 'questions', p.questions.size) } %> + :questions_size => p.sections.map{|s| s.questions.size }.inject(0){|sum,x| sum + x }, + :questions => n_('question', 'questions', p.sections.map{|s| s.questions.size }.inject(0){|sum,x| sum + x }) } %>