Fixed another NPE on the stats page

This commit is contained in:
Godwin 2018-11-08 06:57:53 -08:00 committed by GitHub
parent a7fb14dffd
commit cee50472a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,11 +7,11 @@
= data_set(:h3, 'articles.admin.stats.headings.bikes') do = data_set(:h3, 'articles.admin.stats.headings.bikes') do
= (@completed_registrations || 0) > 0 ? "#{@bikes} (#{number_to_percentage(@bikes / @completed_registrations.to_f * 100.0)})" : "0" = (@completed_registrations || 0) > 0 ? "#{@bikes} (#{number_to_percentage(@bikes / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.meat') do = data_set(:h3, 'articles.admin.stats.headings.food.meat') do
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{number_to_percentage(@food[:meat] / @food[:all].to_f * 100.0)})" : "0" = @food && (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{number_to_percentage(@food[:meat] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.vegetarian') do = data_set(:h3, 'articles.admin.stats.headings.food.vegetarian') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{number_to_percentage(@food[:vegetarian] / @food[:all].to_f * 100.0)})" : "0" = @food && (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{number_to_percentage(@food[:vegetarian] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.food.vegan') do = data_set(:h3, 'articles.admin.stats.headings.food.vegan') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{number_to_percentage(@food[:vegan] / @food[:all].to_f * 100.0)})" : "0" = @food && (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{number_to_percentage(@food[:vegan] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.donation_count') do = data_set(:h3, 'articles.admin.stats.headings.donation_count') do
= (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{number_to_percentage(@donation_count / @completed_registrations.to_f * 100.0)})" : "0" = (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{number_to_percentage(@donation_count / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h3, 'articles.admin.stats.headings.donation_total') do = data_set(:h3, 'articles.admin.stats.headings.donation_total') do