Commit bc25e1314e7dae51dcbd218612a9183c12aee6a6
1 parent
0490f6b7
Exists in
master
and in
1 other branch
fix query for sessions with vote
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/models/question.rb
@@ -735,7 +735,7 @@ class Question < ActiveRecord::Base | @@ -735,7 +735,7 @@ class Question < ActiveRecord::Base | ||
735 | # total number of sessions with at least one vote | 735 | # total number of sessions with at least one vote |
736 | def sessions_with_vote | 736 | def sessions_with_vote |
737 | Question.connection.select_one(" | 737 | Question.connection.select_one(" |
738 | - SELECT COUNT(DISTINCT(appearances.voter_id)) from appearances LEFT JOIN votes ON (votes.voter_id = appearances.voter_id) WHERE votes.id IS NOT NULL AND appearances.question_id = #{self.id} | 738 | + SELECT COUNT(DISTINCT(voter_id)) FROM votes WHERE votes.question_id = #{self.id} |
739 | ").values.first | 739 | ").values.first |
740 | end | 740 | end |
741 | 741 |