You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
498 B
13 lines
498 B
- histogram = data.responses.map(&:answer_index_with_reverse).group_by { |a| a.to_s }
|
|
%table.answers
|
|
%tbody
|
|
- data.question.options.each_with_index do |option, index|
|
|
%tr.answer
|
|
- group = histogram[(index + 1).to_s]
|
|
- width = (100 * (group.blank? ? 0 : group.length)) / histogram.values.flatten.length
|
|
%td.text
|
|
= "#{option}:"
|
|
= group.blank? ? 0 : group.length
|
|
%td.count
|
|
%div{class: "bar#{index}", style: "width: #{width}%"}
|