Merge branch 'statistics' of github.com:differentreality/osem into differentreality-statistics

This commit is contained in:
Ancor Gonzalez Sosa 2013-07-16 15:43:22 +02:00
commit 45b95584e0
4 changed files with 117 additions and 90 deletions

View file

@ -21,10 +21,21 @@ class Admin::StatsController < ApplicationController
@speaker_fields_reg = %w[with_partner need_access other_needs diet arrival departure] @speaker_fields_reg = %w[with_partner need_access other_needs diet arrival departure]
@supporter_levels = @conference.supporter_levels @supporter_levels = @conference.supporter_levels
@tickets = @conference.registrations.find_by_sql("select *
from registrations inner join supporter_registrations
ON registrations.id = supporter_registrations.registration_id
inner join supporter_levels
ON supporter_levels.id = supporter_registrations.supporter_level_id
where registrations.conference_id = #{@conference.id}")
end end
def reg_support(level) def reg_support(level)
Registration.find_by_sql("select supporter_registrations.* FROM registrations, supporter_registrations, supporter_levels WHERE registrations.id = supporter_registrations.registration_id AND registrations.conference_id = #{@conference.id} AND supporter_registrations.supporter_level_id = #{level.id}") Registration.find_by_sql("select supporter_registrations.*
FROM registrations INNER JOIN supporter_registrations
ON registrations.id = supporter_registrations.registration_id
WHERE registrations.conference_id = #{@conference.id}
AND supporter_registrations.supporter_level_id = #{level.id}")
end end
def speaker_reg(speaker) def speaker_reg(speaker)

View file

@ -1,10 +1,14 @@
%h3 .row-fluid
.span12
%h3
Registered Registered
- if @registered - if @registered
= "(#{@registered})" = "(#{@registered})"
- if @attendees - if @attendees
= " - Attendees (#{@attendees})" = " - Attendees (#{@attendees})"
%table.table.table-bordered.table-striped .row-fluid
.span3
%table.table.table-bordered.table-striped
%thead %thead
%th General Stats %th General Stats
%th # %th #
@ -21,13 +25,14 @@
%td Registred to attend with partner %td Registred to attend with partner
%td= @registered_with_partner %td= @registered_with_partner
%tr %tr
%td Handicapped Access for: %td Handicapped Access for
%td= @conference.registrations.where("handicapped_access_required = ?", true).count %td= @conference.registrations.where("handicapped_access_required = ?", true).count
%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 .span3
- if @conference.use_dietary_choices == true
- diet_choices = [] - diet_choices = []
- @conference.dietary_choices.each do |d| - @conference.dietary_choices.each do |d|
- count = @conference.registrations.where("dietary_choice_id = ?", d.id).count - count = @conference.registrations.where("dietary_choice_id = ?", d.id).count
@ -49,8 +54,8 @@
- if @attendees and @attendees > 0 - if @attendees and @attendees > 0
%br %br
= "#{d[1] * 100 / @attendees}% of attendees" = "#{d[1] * 100 / @attendees}% of attendees"
.span3
- 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

View file

@ -1,7 +1,7 @@
- count =0 - count =0
%h3 %h3
Speakers (#{@speakers.length}) Speakers (#{@speakers.length})
%table.table.table-striped.table-bordered.table-hover#events %table.table.table-striped.table-bordered.table-hover#speakertable
%thead %thead
%th %th
ID ID
@ -34,3 +34,10 @@
= getdatetime(reg, field) = getdatetime(reg, field)
- else - else
= reg.send(field.to_sym) = reg.send(field.to_sym)
:javascript
$(document).ready(function(){
$('#speakertable').dataTable({
"bPaginate": false
});
});

View file

@ -1,6 +1,10 @@
%h3 .row-fluid
Tickets (#{@tickets.length if @tickets}#{0 unless @tickets}) .span12
- if @supporter_levels.count > 0 %h3
Non-free Tickets (#{@tickets.length if @tickets}#{0 unless @tickets})
.row-fluid
.span5
- if @supporter_levels.count > 0
%table.table.table-bordered.table-striped %table.table.table-bordered.table-striped
%thead %thead
%th Support Level %th Support Level
@ -19,6 +23,6 @@
- if @attendees and @attendees > 0 - if @attendees and @attendees > 0
%br %br
= "#{reg_support.count * 100 / @attendees}% of attendees" = "#{reg_support.count * 100 / @attendees}% of attendees"
- else - else
%p %p
No tickets sold yet No tickets sold yet