Remove redundant by_question grouping in Admin::Poll::Results::QuestionComponent
Stop grouping partial results by question_id inside the component.
Note that group_by on an empty collection already returns
an empty hash, so the previous "|| {}" is not needed.
This commit is contained in:
@@ -7,12 +7,6 @@ class Admin::Poll::Results::QuestionComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def by_answer
|
||||
@by_answer ||= by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {}
|
||||
@by_answer ||= partial_results.where(question: question).group_by(&:answer)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def by_question
|
||||
@by_question ||= partial_results.group_by(&:question_id)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user