Browse Source

Fixed divide by zero error on stats page

development
Godwin 9 years ago
committed by GitHub
parent
commit
310f2f3d46
  1. 14
      app/views/conferences/admin/_stats.html.haml

14
app/views/conferences/admin/_stats.html.haml

@ -1,17 +1,17 @@
.details
= data_set(:h4, 'articles.admin.stats.headings.registrations') do
= @registrations.size
= (@registration_count || 0).to_s
= data_set(:h4, 'articles.admin.stats.headings.bikes') do
= "#{@bikes} (#{(@bikes / @registration_count) * 100.0}%)"
= (@registration_count || 0) > 0 ? "#{@bikes} (#{(@bikes / @registration_count) * 100.0}%)" : "0"
= data_set(:h4, 'articles.admin.stats.headings.food.meat') do
= "#{@food[:meat]} (#{(@food[:meat] / @food[:all]) * 100.0}%)"
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{(@food[:meat] / @food[:all]) * 100.0}%)" : "0"
= data_set(:h4, 'articles.admin.stats.headings.food.vegetarian') do
= "#{@food[:vegetarian]} (#{(@food[:vegetarian] / @food[:all]) * 100.0}%)"
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{(@food[:vegetarian] / @food[:all]) * 100.0}%)" : "0"
= data_set(:h4, 'articles.admin.stats.headings.food.vegan') do
= "#{@food[:vegan]} (#{(@food[:vegan] / @food[:all]) * 100.0}%)"
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{(@food[:vegan] / @food[:all]) * 100.0}%)" : "0"
= data_set(:h4, 'articles.admin.stats.headings.donation_count') do
= "#{@donation_count} (#{(@donation_count / @registration_count) * 100.0}%)"
= (@registration_count || 0) > 0 ? "#{@donation_count} (#{(@donation_count / @registration_count) * 100.0}%)" : "0"
= data_set(:h4, 'articles.admin.stats.headings.donation_total') do
= "$#{@donations}"
= "$#{@donations || 0.00}"
.actions
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :stats, :format => :xlsx), class: [:button, :download]

Loading…
Cancel
Save