Fix all votes calculation

This commit is contained in:
Petko Bordjukov 2016-10-10 00:33:09 +03:00
parent 03dfaadb82
commit 59046a7b2b
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@ class Summary
def initialize(params = {}) def initialize(params = {})
@talk_id, @other_talk_ids = params[:talk_id], params[:other_talk_ids] @talk_id, @other_talk_ids = params[:talk_id], params[:other_talk_ids]
@votes_count = SelectedTalk.where(talk_id: @talk_id).count @votes_count = SelectedTalk.where(talk_id: @talk_id).count
@all_votes_count = TalkPreference.joins(:selected_talks).where(selected_talks: {talk_id: @other_talk_ids << @talk_id}).count @all_votes_count = TalkPreference.joins(:selected_talks).where(selected_talks: {talk_id: @other_talk_ids << @talk_id}).uniq.count
end end
def summary def summary