fixing most popular answer

pull/1/head
Jared Cosulich 8 years ago
parent 52d31ea0ca
commit 650540b9de

@ -49,7 +49,7 @@ class Question < ApplicationRecord
histogram = school_responses.group_by(&:answer_index_with_reverse) 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_index = histogram.to_a.sort_by { |info| info[1].length }.last[0]
most_popular_answer = send("option#{most_popular_answer_index}") most_popular_answer = options_with_reverse[most_popular_answer_index]
AggregatedResponses.new( AggregatedResponses.new(
self, self,

Loading…
Cancel
Save