This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
binaryattraction/app/helpers/votes_helper.rb

14 lines
613 B
Ruby
Raw Permalink Normal View History

2008-10-01 02:19:35 -04:00
module Merb
module VotesHelper
def stat_chart
curl = Gchart.pie(
:size => '415x275',
:title => "Voting results for #{@user.votes.size} photos. Oneness #{"%.1f%%" % (@user.votes.select { |v| v.one? }.size.to_f / @user.votes.size.to_f * 100.0)}",
:legend => [ "Not One (#{@user.votes.select { |v| v.zero? }.size})", "One (#{@user.votes.select { |v| v.one? }.size})" ],
:data => [ @user.votes.select { |v| v.zero? }.size, @user.votes.select { |v| v.one? }.size ],
:theme => :pastel
)
"<img src='#{curl}' alt='Chart Results' />"
end
2008-10-01 02:19:35 -04:00
end
end # Merb