diff --git a/app/controllers/tag_controller.rb b/app/controllers/tag_controller.rb index 222fc3f350..92d53daf62 100644 --- a/app/controllers/tag_controller.rb +++ b/app/controllers/tag_controller.rb @@ -521,12 +521,11 @@ def stats @all_subscriptions = TagSelection.graph(@start, @end) - @answers = Node.published.questions + total_questions = Node.published.questions .where(created: @start.to_i..@end.to_i) - .where(nid: Node.find_by_tag(tagname)).joins(:comments).size - @questions = Node.published.questions - .where(created: @start.to_i..@end.to_i) - .where(nid: Node.find_by_tag(tagname)).size + .where(nid: Node.find_by_tag(tagname)) + @answers = total_questions.joins(:comments).size.size + @questions = total_questions.size.size end private diff --git a/app/views/tag/stats.html.erb b/app/views/tag/stats.html.erb index ee3d49f958..bc19674734 100644 --- a/app/views/tag/stats.html.erb +++ b/app/views/tag/stats.html.erb @@ -28,7 +28,7 @@ -<% if @questions.count.nonzero? %> +<% if @questions.nonzero? %>

Questions Answered vs. Unanswered