mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Now make it hackable and work with or without data
This commit is contained in:
parent
d96f7d5332
commit
27812216b9
4 changed files with 130 additions and 127 deletions
67
app/views/admin/stats/_registrations.html.haml
Normal file
67
app/views/admin/stats/_registrations.html.haml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
%h3
|
||||
Registered
|
||||
- if @registered
|
||||
= "(#{@registered})"
|
||||
- if @attendees
|
||||
= " - Attendees (#{@attendees})"
|
||||
%table.table.table-bordered.table-striped
|
||||
%thead
|
||||
%th General Stats
|
||||
%th #
|
||||
%tr
|
||||
%td Registered attended
|
||||
%td= @registered_attended
|
||||
%tr
|
||||
%td Registered not attended
|
||||
%td= @registered_not_attended
|
||||
%tr
|
||||
%td Attended with partner
|
||||
%td= @attended_with_partner
|
||||
%tr
|
||||
%td Registred to attend with partner
|
||||
%td= @registered_with_partner
|
||||
%tr
|
||||
%td Handicapped Access for:
|
||||
%td= @conference.registrations.where("handicapped_access_required = ?", true).count
|
||||
%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 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]
|
||||
36
app/views/admin/stats/_speakers.html.haml
Normal file
36
app/views/admin/stats/_speakers.html.haml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
- count =0
|
||||
%h3
|
||||
Speakers (#{@speakers.length})
|
||||
%table.table.table-striped.table-bordered.table-hover#events
|
||||
%thead
|
||||
%th
|
||||
ID
|
||||
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
||||
%th
|
||||
= field.capitalize
|
||||
- @speakers.each do |speaker|
|
||||
%tr
|
||||
%td
|
||||
= count +=1
|
||||
- @speaker_fields_person.each do |field|
|
||||
%td
|
||||
- if field == 'name'
|
||||
= speaker.first_name
|
||||
= speaker.last_name
|
||||
%br
|
||||
(#{speaker.public_name})
|
||||
- else
|
||||
= speaker.send(field.to_sym)
|
||||
- @speaker_fields_reg.each do |field|
|
||||
%td
|
||||
- reg = speaker_reg(speaker)
|
||||
- if !reg.nil?
|
||||
- if field == "diet"
|
||||
- if reg.dietary_choice_id
|
||||
= speaker_diet(reg).title
|
||||
%br
|
||||
= reg.other_dietary_choice
|
||||
- elsif field == 'arrival' || field == 'departure'
|
||||
= getdatetime(reg, field)
|
||||
- else
|
||||
= reg.send(field.to_sym)
|
||||
24
app/views/admin/stats/_tickets.html.haml
Normal file
24
app/views/admin/stats/_tickets.html.haml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
%h3
|
||||
Tickets (#{@tickets.length if @tickets}#{0 unless @tickets})
|
||||
- if @supporter_levels.count > 0
|
||||
%table.table.table-bordered.table-striped
|
||||
%thead
|
||||
%th Support Level
|
||||
%th #
|
||||
%th %
|
||||
- @supporter_levels.each do |level|
|
||||
- reg_support = reg_support(level)
|
||||
- if reg_support.count > 0
|
||||
%tr
|
||||
%td= level.title
|
||||
%td
|
||||
= reg_support.count
|
||||
%td
|
||||
- if @registered and @registered > 0
|
||||
= "#{reg_support.count * 100 / @registered}% of registered"
|
||||
- if @attendees and @attendees > 0
|
||||
%br
|
||||
= "#{reg_support.count * 100 / @attendees}% of attendees"
|
||||
- else
|
||||
%p
|
||||
No tickets sold yet
|
||||
|
|
@ -10,135 +10,11 @@
|
|||
|
||||
.tab-content
|
||||
.tab-pane.active#registrations
|
||||
%h3
|
||||
Registered
|
||||
- if @registered
|
||||
= "(#{@registered})"
|
||||
- if @attendees
|
||||
= " - Attendees (#{@attendees})"
|
||||
%table.table.table-bordered.table-striped
|
||||
%thead
|
||||
%th General Stats
|
||||
%th #
|
||||
%tr
|
||||
%td Registered attended
|
||||
%td= @registered_attended
|
||||
%tr
|
||||
%td Registered not attended
|
||||
%td= @registered_not_attended
|
||||
%tr
|
||||
%td Attended with partner
|
||||
%td= @attended_with_partner
|
||||
%tr
|
||||
%td Registred to attend with partner
|
||||
%td= @registered_with_partner
|
||||
%tr
|
||||
%td Handicapped Access for:
|
||||
%td= @conference.registrations.where("handicapped_access_required = ?", true).count
|
||||
%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 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
|
||||
= "#{d[1] * 100 / @registered}% of registered"
|
||||
- if @attendees
|
||||
%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]
|
||||
= render :partial => 'registrations'
|
||||
.tab-pane#speakers
|
||||
- count =0
|
||||
%h3
|
||||
Speakers (#{@speakers.length})
|
||||
%br
|
||||
|
||||
%table.table.table-striped.table-bordered.table-hover#events
|
||||
%thead
|
||||
%th
|
||||
ID
|
||||
- (@speaker_fields_person + @speaker_fields_reg).each do |field|
|
||||
%th
|
||||
= field.capitalize
|
||||
|
||||
- @speakers.each do |speaker|
|
||||
%tr
|
||||
%td
|
||||
= count +=1
|
||||
|
||||
- @speaker_fields_person.each do |field|
|
||||
%td
|
||||
- if field == 'name'
|
||||
= speaker.first_name
|
||||
= speaker.last_name
|
||||
%br
|
||||
(#{speaker.public_name})
|
||||
- else
|
||||
= speaker.send(field.to_sym)
|
||||
- @speaker_fields_reg.each do |field|
|
||||
%td
|
||||
- reg = speaker_reg(speaker)
|
||||
- if !reg.nil?
|
||||
- if field == "diet"
|
||||
- if reg.dietary_choice_id
|
||||
= speaker_diet(reg).title
|
||||
%br
|
||||
= reg.other_dietary_choice
|
||||
- elsif field == 'arrival' || field == 'departure'
|
||||
= getdatetime(reg, field)
|
||||
- else
|
||||
= reg.send(field.to_sym)
|
||||
= render :partial => 'speakers'
|
||||
.tab-pane#tickets
|
||||
- if @supporter_levels.count > 0
|
||||
%table.table.table-bordered.table-striped
|
||||
%thead
|
||||
%th Support Level
|
||||
%th #
|
||||
%th %
|
||||
- @supporter_levels.each do |level|
|
||||
- reg_support = reg_support(level)
|
||||
- if reg_support.count > 0
|
||||
%tr
|
||||
%td= level.title
|
||||
%td
|
||||
= reg_support.count
|
||||
%td
|
||||
= "#{reg_support.count * 100 / @registered}% of registered"
|
||||
- if @attendees
|
||||
%br
|
||||
= "#{reg_support.count * 100 / @attendees}% of attendees"
|
||||
- else
|
||||
%p
|
||||
No tickets sold yet
|
||||
= render :partial => 'tickets'
|
||||
|
||||
:javascript
|
||||
$('#myTab a').click(function (e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue