mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge pull request #41 from differentreality/stats_fix
Fixing some numbers there
This commit is contained in:
commit
6c050ccbc2
3 changed files with 24 additions and 9 deletions
|
|
@ -6,9 +6,14 @@ class Admin::StatsController < ApplicationController
|
||||||
|
|
||||||
@attendees = @conference.registrations.where("attended = ?", true).count
|
@attendees = @conference.registrations.where("attended = ?", true).count
|
||||||
@registered = @conference.registrations.count
|
@registered = @conference.registrations.count
|
||||||
|
@pre_registered = @conference.registrations.where("created_at < ?", @conference.start_date).count
|
||||||
|
@pre_registered_attended = @conference.registrations.where("created_at < ? AND attended = ?", @conference.start_date, true).count
|
||||||
|
|
||||||
@registered_with_partner = @conference.registrations.where("attending_with_partner = ?", true).count
|
@registered_with_partner = @conference.registrations.where("attending_with_partner = ?", true).count
|
||||||
@attended_with_partner = @conference.registrations.where("attending_with_partner = ? AND attended = ?", true, true).count
|
@attended_with_partner = @conference.registrations.where("attending_with_partner = ? AND attended = ?", true, true).count
|
||||||
|
|
||||||
|
@handicapped_access = @conference.registrations.where("handicapped_access_required = ?", true).count
|
||||||
|
@suggested_hotel_stay = @conference.registrations.where("using_affiliated_lodging = ?", true).count
|
||||||
|
|
||||||
@speakers = Person.joins(:events).where("events.conference_id = ? AND events.state LIKE ?", @conference.id, 'confirmed').uniq
|
@speakers = Person.joins(:events).where("events.conference_id = ? AND events.state LIKE ?", @conference.id, 'confirmed').uniq
|
||||||
@speaker_fields_person = %w[name email affiliation]
|
@speaker_fields_person = %w[name email affiliation]
|
||||||
|
|
@ -16,7 +21,7 @@ class Admin::StatsController < ApplicationController
|
||||||
|
|
||||||
@supporter_levels = @conference.supporter_levels
|
@supporter_levels = @conference.supporter_levels
|
||||||
@tickets = @conference.registrations.joins(:supporter_registration => :supporter_level)
|
@tickets = @conference.registrations.joins(:supporter_registration => :supporter_level)
|
||||||
@tickets = @tickets.where("registrations.conference_id" => @conference).count
|
@tickets = @tickets.where("registrations.conference_id = ? AND supporter_levels.title NOT LIKE ? ", @conference, "%Free%").count
|
||||||
end
|
end
|
||||||
|
|
||||||
def speaker_reg(speaker)
|
def speaker_reg(speaker)
|
||||||
|
|
@ -27,6 +32,16 @@ class Admin::StatsController < ApplicationController
|
||||||
@conference.dietary_choices.find(reg.dietary_choice_id)
|
@conference.dietary_choices.find(reg.dietary_choice_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def diet_count(diet)
|
||||||
|
@conference.registrations.where("dietary_choice_id = ?", diet).count
|
||||||
|
end
|
||||||
|
|
||||||
|
def social_event_count(event)
|
||||||
|
@conference.registrations.joins(:social_events).where("registrations_social_events.social_event_id = ?", event).count
|
||||||
|
end
|
||||||
|
|
||||||
helper_method :speaker_reg
|
helper_method :speaker_reg
|
||||||
helper_method :speaker_diet
|
helper_method :speaker_diet
|
||||||
|
helper_method :diet_count
|
||||||
|
helper_method :social_event_count
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
.row-fluid
|
.row-fluid
|
||||||
.span12
|
.span12
|
||||||
%h3
|
%h3
|
||||||
Registered
|
Total Registrations
|
||||||
- if @registered
|
- if @registered
|
||||||
= "(#{@registered})"
|
= "(#{@registered})"
|
||||||
- if @attendees
|
- if @attendees
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
%th #
|
%th #
|
||||||
%tr
|
%tr
|
||||||
%td Registered attended
|
%td Registered attended
|
||||||
%td= @registered_attended
|
%td= @pre_registered_attended
|
||||||
%tr
|
%tr
|
||||||
%td Registered not attended
|
%td Registered not attended
|
||||||
%td= @registered_not_attended
|
%td= @pre_registered - @pre_registered_attended
|
||||||
%tr
|
%tr
|
||||||
%td Attended with partner
|
%td Attended with partner
|
||||||
%td= @attended_with_partner
|
%td= @attended_with_partner
|
||||||
|
|
@ -26,16 +26,16 @@
|
||||||
%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= @handicapped_access
|
||||||
%tr
|
%tr
|
||||||
%td Staying at suggested hotel
|
%td Staying at suggested hotel
|
||||||
%td= @conference.registrations.where("using_affiliated_lodging = ?", true).count
|
%td= @suggested_hotel_stay
|
||||||
|
|
||||||
.span3
|
.span3
|
||||||
- if @conference.use_dietary_choices == true
|
- 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 = diet_count(d.id)
|
||||||
- if count > 0
|
- if count > 0
|
||||||
- diet_choices << [d.title, count]
|
- diet_choices << [d.title, count]
|
||||||
- if diet_choices.any?
|
- if diet_choices.any?
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
- 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 = social_event_count(social_event)
|
||||||
- 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?
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
%th #
|
%th #
|
||||||
%th %
|
%th %
|
||||||
- @supporter_levels.each do |level|
|
- @supporter_levels.each do |level|
|
||||||
- reg_count = level.supporter_registrations.count
|
- reg_count = level.supporter_registrations.where(conference_id: @conference).count
|
||||||
- if reg_count > 0
|
- if reg_count > 0
|
||||||
%tr
|
%tr
|
||||||
%td= level.title
|
%td= level.title
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue