From 83c2834887e4202ee9916fbbc9e45db887a00458 Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Sat, 28 Oct 2017 16:41:43 -0400 Subject: [PATCH] fixing most popular answer --- app/models/question.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/question.rb b/app/models/question.rb index 0de2cf93..9688d4b8 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -49,7 +49,7 @@ class Question < ApplicationRecord histogram = school_responses.group_by(&:answer_index_with_reverse) most_popular_answer_index = histogram.to_a.sort_by { |info| info[1].length }.last[0] - most_popular_answer = options_with_reverse[most_popular_answer_index] + most_popular_answer = options_with_reverse[most_popular_answer_index - 1] AggregatedResponses.new( self,