From 380d38d80e248dfb391568c14242aeb93e988ea0 Mon Sep 17 00:00:00 2001 From: Godwin Date: Sun, 27 Jul 2014 23:41:03 -0600 Subject: [PATCH] Some additions to registrations page --- app/views/conferences/registrations.html.haml | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/app/views/conferences/registrations.html.haml b/app/views/conferences/registrations.html.haml index f6e1cc7..d1f189f 100644 --- a/app/views/conferences/registrations.html.haml +++ b/app/views/conferences/registrations.html.haml @@ -4,7 +4,7 @@ - title @conference.title - description "#{@conference.title} conference in #{location_name} for DIY bicycle collectives, co-ops, and advocacy groups" = render 'header' -- stats = {confirmed: 0, completed: 0, total: 0, paid: 0, collected: 0} +- stats = {confirmed: 0, completed: 0, total: 0, paid: 0, collected: 0, housing_total: 0, housing_beds: 0, housing_couches: 0, housing_campers: 0, bikes: 0, small_bikes: 0, large_bikes: 0} %article.row .columns.large-10 %h2=_'conference.registrations.title','Registrations' @@ -17,6 +17,8 @@ %th='Confirmed?' %th='Completed?' %th='Paid?' + %th='Housing' + %th='Bike' - @registrations.each do |registration| %tr - data = YAML.load(registration.data) @@ -26,25 +28,43 @@ - stats[:completed] += (registration.completed ? 1 : 0) - stats[:paid] += (registration.registration_fees_paid ? 1 : 0) - stats[:collected] += (registration.registration_fees_paid || 0) - %td.user{rowspan: (user.present? ? 2 : nil), id: user ? "user-#{user.id}" : nil}=registration.email + - stats[:housing_total] += (data[:questions][:housing] == 'none' ? 0 : 1) + - stats[:housing_beds] += (data[:questions][:housing] == 'bed' ? 1 : 0) + - stats[:housing_couches] += (data[:questions][:housing] == 'couch' ? 1 : 0) + - stats[:housing_campers] += (data[:questions][:housing] == 'camp' ? 1 : 0) + - stats[:bikes] += (data[:questions][:housing] == 'no' ? 0 : 1) + - stats[:small_bikes] += (data[:questions][:housing] == 'small' ? 1 : 0) + - stats[:large_bikes] += (data[:questions][:housing] == 'large' ? 1 : 0) + - rows = 1 + (user.present? ? 1 : 0) + (data[:questions][:housing_extra].present? ? 1 :0) + (data[:questions][:other].present? ? 1 :0) + %td.user{rowspan: (rows > 1 ? rows : nil), id: user ? "user-#{user.id}" : nil}=registration.email %td=data[:user][:firstname] %td=data[:user][:lastname] %td=data[:user][:username] %td=registration.is_confirmed ? 'Yes' : 'No' %td=registration.completed ? 'Yes' : 'No' %td=registration.registration_fees_paid.nil? ? 'No' : 'Yes' + %td=data[:questions][:housing] + %td=data[:questions][:loaner_bike] - if user.present? %tr %th='Organizations' - %td{colspan: 2} + %td{colspan: 3} - UserOrganizationRelationship.where(:user_id => user.id).each do |rel| - org = Organization.find(rel.organization_id) - location_name = "#{org.locations[0].city}, #{org.locations[0].territory}" = link_to "#{org.name} (#{location_name})", org %th='Workshops' - %td{colspan: 2} + %td{colspan: 3} - Workshop.where('workshop_facilitators.user_id' => user.id, :conference_id => @conference.id).joins(:workshop_facilitators).each do | workshop | %a{href: "#workshop-#{workshop.slug}"}= workshop.title + - if data[:questions][:housing_extra].present? + %tr + %th='Housing Notes' + %td=data[:questions][:housing_extra] + - if data[:questions][:other].present? + %tr + %th='Other Notes' + %td=data[:questions][:other] %h3=_'conference.registrations.workshops.title','Workshops' %ul @@ -79,3 +99,24 @@ %tr %th='Fees Collected:' %td=number_to_currency(stats[:collected], :unit => '$') + %tr + %th='Housing Total:' + %td=stats[:housing_total] + %tr + %th='Beds:' + %td=stats[:housing_beds] + %tr + %th='Couch / Floorspace:' + %td=stats[:housing_couches] + %tr + %th='Campers:' + %td=stats[:housing_campers] + %tr + %th='Bikes Required:' + %td=stats[:bikes] + %tr + %th='Small Bikes:' + %td=stats[:small_bikes] + %tr + %th='Large Bikes:' + %td=stats[:large_bikes]