|
@ -436,53 +436,58 @@ class ConferencesController < ApplicationController |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
@registrations.each do |r| |
|
|
@registrations.each do |r| |
|
|
if r.is_attending |
|
|
if r && r.is_attending |
|
|
@total_registrations += 1 |
|
|
begin |
|
|
|
|
|
@total_registrations += 1 |
|
|
|
|
|
|
|
|
@donation_count += 1 if r.registration_fees_paid |
|
|
@donation_count += 1 if r.registration_fees_paid |
|
|
@total_donations += r.registration_fees_paid unless r.registration_fees_paid.blank? |
|
|
@total_donations += r.registration_fees_paid unless r.registration_fees_paid.blank? |
|
|
|
|
|
|
|
|
unless r.housing.blank? |
|
|
unless r.housing.blank? |
|
|
@housing[r.housing.to_sym] ||= 0 |
|
|
@housing[r.housing.to_sym] ||= 0 |
|
|
@housing[r.housing.to_sym] += 1 |
|
|
@housing[r.housing.to_sym] += 1 |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
unless r.bike.blank? |
|
|
unless r.bike.blank? |
|
|
@bikes[r.bike.to_sym] ||= 0 |
|
|
@bikes[r.bike.to_sym] ||= 0 |
|
|
@bikes[r.bike.to_sym] += 1 |
|
|
@bikes[r.bike.to_sym] += 1 |
|
|
@bike_count += 1 unless r.bike.to_sym == :none |
|
|
@bike_count += 1 unless r.bike.to_sym == :none |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
unless r.food.blank? |
|
|
unless r.food.blank? |
|
|
@food[r.food.to_sym] ||= 0 |
|
|
@food[r.food.to_sym] ||= 0 |
|
|
@food[r.food.to_sym] += 1 |
|
|
@food[r.food.to_sym] += 1 |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
@allergies << r.allergies unless r.allergies.blank? |
|
|
@allergies << r.allergies unless r.allergies.blank? |
|
|
@other << r.other unless r.other.blank? |
|
|
@other << r.other unless r.other.blank? |
|
|
|
|
|
|
|
|
JSON.parse(r.languages).each do |l| |
|
|
JSON.parse(r.languages).each do |l| |
|
|
@languages[l.to_sym] ||= 0 |
|
|
@languages[l.to_sym] ||= 0 |
|
|
@languages[l.to_sym] += 1 |
|
|
@languages[l.to_sym] += 1 |
|
|
end unless r.languages.blank? |
|
|
end unless r.languages.blank? |
|
|
|
|
|
|
|
|
if @excel_data |
|
|
if @excel_data |
|
|
user = User.find(r.user_id) |
|
|
user = User.find(r.user_id) |
|
|
@excel_data[:data] << { |
|
|
@excel_data[:data] << { |
|
|
:name => (user ? user.firstname : nil) || '', |
|
|
:name => (user ? user.firstname : nil) || '', |
|
|
:email => (user ? user.email : nil) || '', |
|
|
:email => (user ? user.email : nil) || '', |
|
|
:date => r.created_at ? r.created_at.strftime("%F %T") : '', |
|
|
:date => r.created_at ? r.created_at.strftime("%F %T") : '', |
|
|
:city => r.city || '', |
|
|
:city => r.city || '', |
|
|
:languages => ((JSON.parse(r.languages || '[]').map { |x| I18n.t"languages.#{x}" }).join(', ').to_s), |
|
|
:languages => ((JSON.parse(r.languages || '[]').map { |x| I18n.t"languages.#{x}" }).join(', ').to_s), |
|
|
:arrival => r.arrival ? r.arrival.strftime("%F %T") : '', |
|
|
:arrival => r.arrival ? r.arrival.strftime("%F %T") : '', |
|
|
:departure => r.departure ? r.departure.strftime("%F %T") : '', |
|
|
:departure => r.departure ? r.departure.strftime("%F %T") : '', |
|
|
:housing => (I18n.t"articles.conference_registration.questions.housing.#{r.housing || 'none'}"), |
|
|
:housing => (I18n.t"articles.conference_registration.questions.housing.#{r.housing || 'none'}"), |
|
|
:bike => (I18n.t"articles.conference_registration.questions.bike.#{r.bike || 'none'}"), |
|
|
:bike => (I18n.t"articles.conference_registration.questions.bike.#{r.bike || 'none'}"), |
|
|
:food => (I18n.t"articles.conference_registration.questions.food.#{r.food || 'meat'}"), |
|
|
:food => (I18n.t"articles.conference_registration.questions.food.#{r.food || 'meat'}"), |
|
|
:fees_paid => (r.registration_fees_paid || 0.0), |
|
|
:fees_paid => (r.registration_fees_paid || 0.0), |
|
|
:allergies => r.allergies || '', |
|
|
:allergies => r.allergies || '', |
|
|
:other => r.other || '' |
|
|
:other => r.other || '' |
|
|
} |
|
|
} |
|
|
|
|
|
end |
|
|
|
|
|
rescue |
|
|
|
|
|
logger.info "Error adding row to stats.xls" |
|
|
|
|
|
logger.info "\t#{r ? r.to_yaml.to_s : 'nil'}" |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|