Sha256: 5bd66bc17bef6846fdd5a4dec70fc9c56f200dc24ac5715271d48df2f65e8134

Contents?: true

Size: 298 Bytes

Versions: 3

Compression:

Stored size: 298 Bytes

Contents

module Cms::PollsHelper
  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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bcms_polling-1.0.3 app/helpers/cms/polls_helper.rb
bcms_polling-1.0.2 app/helpers/cms/polls_helper.rb
bcms_polling-1.0.0 app/helpers/cms/polls_helper.rb