Skip to content

Commit

Permalink
change code in tag stats to match main stats page (publiclab#8679)
Browse files Browse the repository at this point in the history
  • Loading branch information
nstjean authored and manchere committed Feb 13, 2021
1 parent cb0fa52 commit 7984c83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/tag/stats.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>


<% if @questions.count.nonzero? %>
<% if @questions.nonzero? %>
<br><br>
<h4 align="center">Questions Answered vs. Unanswered</h4>
<div align="right" id="questAns"> </div>
Expand Down

0 comments on commit 7984c83

Please sign in to comment.