More fixes for the regitrations tab

This commit is contained in:
Henne Vogelsang 2013-07-12 15:27:46 +02:00
parent 27812216b9
commit 9e92d1f593

View file

@ -26,42 +26,42 @@
%tr %tr
%td Staying at suggested hotel: %td Staying at suggested hotel:
%td= @conference.registrations.where("using_affiliated_lodging = ?", true).count %td= @conference.registrations.where("using_affiliated_lodging = ?", true).count
- if @conference.use_dietary_choices == true
- diet_choices = [] - if @conference.use_dietary_choices == true
- @conference.dietary_choices.each do |d| - diet_choices = []
- count = @conference.registrations.where("dietary_choice_id = ?", d.id).count - @conference.dietary_choices.each do |d|
- if count > 0 - count = @conference.registrations.where("dietary_choice_id = ?", d.id).count
- diet_choices << [d.title, count] - if count > 0
- diet_choices << [d.title, count]
- if diet_choices.any? - if diet_choices.any?
.span4 %table.table.table-bordered.table-striped
%table.table.table-bordered.table-striped %thead
%thead %th Dietary Choice
%th Dietary Choice %th #
%th # %th Percentage
%th Percentage - diet_choices.each do |d|
- diet_choices.each do |d| %tr
%tr %td= d[0]
%td= d[0] %td= d[1]
%td= d[1] %td
%td - if @registered and @registered > 0
- if @registered and @registered > 0 = "#{d[1] * 100 / @registered}% of registered"
= "#{d[1] * 100 / @registered}% of registered" - if @attendees and @attendees > 0
- if @attendees and @attendees > 0 %br
%br = "#{d[1] * 100 / @attendees}% of attendees"
= "#{d[1] * 100 / @attendees}% of attendees"
- if @conference.social_events.count > 0 - if @conference.social_events.count > 0
- social_events = [] - social_events = []
- @conference.social_events.each do |social_event| - @conference.social_events.each do |social_event|
- count = @conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", social_event.id).count - count = @conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", social_event.id).count
- if count > 0 - if count > 0
- social_events << [social_event.title, count] - social_events << [social_event.title, count]
- if social_events.any? - if social_events.any?
.span4 %table.table.table-bordered.table-striped
%table.table.table-bordered.table-striped %thead
%thead %th Social Event
%th Social Event %th #
%th # - social_events.each do |s|
- social_events.each do |s| %tr
%tr %td= s[0]
%td= s[0] %td= s[1]
%td= s[1]