Guest User

Untitled

a guest
May 24th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def results
  2. max = 0.0
  3. topic_votes.count(:all, :group => ['option_id']).tap { |a| max = a.max { |a, b| a[1] <=> b[1] }[1].to_f }.collect { |pair| [Option.find(pair[0]), pair[1] / max] }
  4. end
Add Comment
Please, Sign In to add comment