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