From 59046a7b2bf9a28aaf4332a81210afd7f745bc06 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Oct 2016 00:33:09 +0300 Subject: [PATCH] Fix all votes calculation --- app/models/summary.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/summary.rb b/app/models/summary.rb index d55f7aa..ed05dd5 100644 --- a/app/models/summary.rb +++ b/app/models/summary.rb @@ -2,7 +2,7 @@ class Summary def initialize(params = {}) @talk_id, @other_talk_ids = params[:talk_id], params[:other_talk_ids] @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 def summary