Module: BcmsPolling::PollsHelper

Included in:
PollingController
Defined in:
app/helpers/bcms_polling/polls_helper.rb

Instance Method Summary collapse

Instance Method Details



7
8
9
# File 'app/helpers/bcms_polling/polls_helper.rb', line 7

def cookie_for(poll)
  "cmspolls_#{poll.id}".to_sym
end

#response_results(response) ⇒ Object



2
3
4
5
# File 'app/helpers/bcms_polling/polls_helper.rb', line 2

def response_results(response)
  total = response.poll.total_votes == 0 ? 0 : (response.votes.to_f / response.poll.total_votes.to_f) * 100
  "#{response.votes} votes (#{sprintf("%.2f", total)}%)"
end