Module: BcmsPolling::PollsHelper
- Included in:
- PollingController
- Defined in:
- app/helpers/bcms_polling/polls_helper.rb
Instance Method Summary collapse
Instance Method Details
#cookie_for(poll) ⇒ Object
7 8 9 |
# File 'app/helpers/bcms_polling/polls_helper.rb', line 7 def (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 |