@ -70,6 +70,17 @@ class ConferenceAdministrationController < ApplicationController
end
end
end
end
def previous_stats
set_conference
conference = Conference . find_by_slug ( params [ :conference_slug ] )
return do_403 unless conference . is_public
get_stats ( false , nil , conference )
logger . info " Generating #{ conference . slug } .xls "
return respond_to do | format |
format . xlsx { render xlsx : '../conferences/stats' , filename : " stats- #{ conference . slug } " }
end
end
rescue_from ActiveRecord :: PremissionDenied do | exception |
rescue_from ActiveRecord :: PremissionDenied do | exception |
do_403
do_403
end
end
@ -99,6 +110,9 @@ class ConferenceAdministrationController < ApplicationController
def administrate_description
def administrate_description
end
end
def administrate_group_ride
end
def administrate_poster
def administrate_poster
end
end
@ -119,6 +133,30 @@ class ConferenceAdministrationController < ApplicationController
def administrate_payment_message
def administrate_payment_message
end
end
def administrate_housing_info
end
def administrate_workshop_info
end
def administrate_schedule_info
end
def administrate_travel_info
end
def administrate_city_info
end
def administrate_what_to_bring
end
def administrate_volunteering_info
end
def administrate_additional_details
end
def administrate_suggested_amounts
def administrate_suggested_amounts
end
end
@ -168,7 +206,7 @@ class ConferenceAdministrationController < ApplicationController
end
end
end
end
return respond_to do | format |
return respond_to do | format |
format . xlsx { render xlsx : :stats , filename : " organizations " }
format . xlsx { render xlsx : '../conferences/stats' , filename : " organizations " }
end
end
end
end
end
end
@ -184,7 +222,7 @@ class ConferenceAdministrationController < ApplicationController
if request . format . xlsx?
if request . format . xlsx?
logger . info " Generating stats.xls "
logger . info " Generating stats.xls "
return respond_to do | format |
return respond_to do | format |
format . xlsx { render xlsx : :stats , filename : " stats- #{ DateTime . now . strftime ( '%Y-%m-%d' ) } " }
format . xlsx { render xlsx : '../conferences/stats' , filename : " stats- #{ DateTime . now . strftime ( '%Y-%m-%d' ) } " }
end
end
end
end
@ -224,7 +262,7 @@ class ConferenceAdministrationController < ApplicationController
if request . format . xlsx?
if request . format . xlsx?
logger . info " Generating stats.xls "
logger . info " Generating stats.xls "
return respond_to do | format |
return respond_to do | format |
format . xlsx { render xlsx : :stats , filename : " stats- #{ DateTime . now . strftime ( '%Y-%m-%d' ) } " }
format . xlsx { render xlsx : '../conferences/stats' , filename : " stats- #{ DateTime . now . strftime ( '%Y-%m-%d' ) } " }
end
end
else
else
@registration_count = @registrations . size
@registration_count = @registrations . size
@ -250,6 +288,11 @@ class ConferenceAdministrationController < ApplicationController
end
end
end
end
end
end
@past_conferences = [ ]
Conference . all . order ( " start_date DESC " ) . each do | conference |
@past_conferences << conference if conference . is_public && @this_conference . id != conference . id
end
end
end
end
end
@ -327,7 +370,7 @@ class ConferenceAdministrationController < ApplicationController
@excel_data [ :data ] << host_data
@excel_data [ :data ] << host_data
end
end
return respond_to do | format |
return respond_to do | format |
format . xlsx { render xlsx : :stats , filename : " housing " }
format . xlsx { render xlsx : '../conferences/stats' , filename : " housing " }
end
end
end
end
end
end
@ -379,8 +422,8 @@ class ConferenceAdministrationController < ApplicationController
def administrate_publish_schedule
def administrate_publish_schedule
end
end
def get_stats ( html_format = false , id = nil )
def get_stats ( html_format = false , id = nil , conference = @this_conference )
@registrations = ConferenceRegistration . where ( :conference_id = > @this_ conference. id ) . sort { | a , b | ( a . user . present? ? ( a . user . firstname || '' ) : '' ) . downcase < = > ( b . user . present? ? ( b . user . firstname || '' ) : '' ) . downcase }
@registrations = ConferenceRegistration . where ( conference_id : conference . id ) . sort { | a , b | ( a . user . present? ? ( a . user . firstname || '' ) : '' ) . downcase < = > ( b . user . present? ? ( b . user . firstname || '' ) : '' ) . downcase }
@excel_data = {
@excel_data = {
columns : [
columns : [
:name ,
:name ,
@ -402,7 +445,6 @@ class ConferenceAdministrationController < ApplicationController
:food ,
:food ,
:companion ,
:companion ,
:companion_email ,
:companion_email ,
:allergies ,
:other ,
:other ,
:can_provide_housing ,
:can_provide_housing ,
:first_day ,
:first_day ,
@ -421,7 +463,6 @@ class ConferenceAdministrationController < ApplicationController
arrival : [ :date , :day ] ,
arrival : [ :date , :day ] ,
departure : [ :date , :day ] ,
departure : [ :date , :day ] ,
registration_fees_paid : :money ,
registration_fees_paid : :money ,
allergies : :text ,
other : :text ,
other : :text ,
first_day : [ :date , :day ] ,
first_day : [ :date , :day ] ,
last_day : [ :date , :day ] ,
last_day : [ :date , :day ] ,
@ -443,7 +484,6 @@ class ConferenceAdministrationController < ApplicationController
food : 'forms.labels.generic.food' ,
food : 'forms.labels.generic.food' ,
companion : 'articles.conference_registration.terms.companion' ,
companion : 'articles.conference_registration.terms.companion' ,
companion_email : 'articles.conference_registration.terms.companion_email' ,
companion_email : 'articles.conference_registration.terms.companion_email' ,
allergies : 'forms.labels.generic.allergies' ,
registration_fees_paid : 'articles.conference_registration.headings.fees_paid' ,
registration_fees_paid : 'articles.conference_registration.headings.fees_paid' ,
other : 'forms.labels.generic.other_notes' ,
other : 'forms.labels.generic.other_notes' ,
can_provide_housing : 'articles.conference_registration.can_provide_housing' ,
can_provide_housing : 'articles.conference_registration.can_provide_housing' ,
@ -458,6 +498,11 @@ class ConferenceAdministrationController < ApplicationController
} ,
} ,
data : [ ]
data : [ ]
}
}
if conference . id != @this_conference . id
@excel_data [ :columns ] -= [ :name , :email ]
end
User . AVAILABLE_LANGUAGES . each do | l |
User . AVAILABLE_LANGUAGES . each do | l |
@excel_data [ :keys ] [ " language_ #{ l } " . to_sym ] = " languages. #{ l . to_s } "
@excel_data [ :keys ] [ " language_ #{ l } " . to_sym ] = " languages. #{ l . to_s } "
end
end
@ -497,10 +542,9 @@ class ConferenceAdministrationController < ApplicationController
bike : r . bike . present? ? ( view_context . _ " articles.conference_registration.questions.bike. #{ r . bike } " ) : '' ,
bike : r . bike . present? ? ( view_context . _ " articles.conference_registration.questions.bike. #{ r . bike } " ) : '' ,
food : r . food . present? ? ( view_context . _ " articles.conference_registration.questions.food. #{ r . food } " ) : '' ,
food : r . food . present? ? ( view_context . _ " articles.conference_registration.questions.food. #{ r . food } " ) : '' ,
companion : companion ,
companion : companion ,
companion_email : ( housing_data [ 'companions' ] || [ '' ] ) . first ,
companion_email : ( housing_data [ 'companion' ] || { 'email' = > '' } ) [ 'email' ] ,
allergies : r . allergies ,
registration_fees_paid : r . registration_fees_paid ,
registration_fees_paid : r . registration_fees_paid ,
other : r . other ,
other : r . allergies . present? ? " #{ r . allergies } \n \n #{ r . other } " : r . other ,
can_provide_housing : r . can_provide_housing ? ( view_context . _ 'articles.conference_registration.questions.bike.yes' ) : '' ,
can_provide_housing : r . can_provide_housing ? ( view_context . _ 'articles.conference_registration.questions.bike.yes' ) : '' ,
first_day : availability [ 0 ] . present? ? availability [ 0 ] . strftime ( " %F %T " ) : '' ,
first_day : availability [ 0 ] . present? ? availability [ 0 ] . strftime ( " %F %T " ) : '' ,
last_day : availability [ 1 ] . present? ? availability [ 1 ] . strftime ( " %F %T " ) : '' ,
last_day : availability [ 1 ] . present? ? availability [ 1 ] . strftime ( " %F %T " ) : '' ,
@ -650,12 +694,16 @@ class ConferenceAdministrationController < ApplicationController
@housing_data [ host_id ] [ :guest_data ] [ guest_id ] [ :warnings ] [ :space ] = { actual : ( view_context . _ " forms.labels.generic. #{ space . to_s } " ) , expected : ( view_context . _ " articles.conference_registration.questions.housing. #{ guest . housing } " ) }
@housing_data [ host_id ] [ :guest_data ] [ guest_id ] [ :warnings ] [ :space ] = { actual : ( view_context . _ " forms.labels.generic. #{ space . to_s } " ) , expected : ( view_context . _ " articles.conference_registration.questions.housing. #{ guest . housing } " ) }
end
end
companions = data [ 'companions' ] || [ ]
if data [ 'companion' ] . present?
companions . each do | companion |
companion = if data [ 'companion' ] [ 'id' ] . present?
user = User . find_user ( companion )
User . find ( data [ 'companion' ] [ 'id' ] )
if user . present?
else
User . find_user ( data [ 'companion' ] [ 'email' ] )
end
if companion . present?
reg = ConferenceRegistration . find_by (
reg = ConferenceRegistration . find_by (
user_id : user . id ,
user_id : companion . id ,
conference_id : @this_conference . id
conference_id : @this_conference . id
)
)
if reg . present? && @guests [ reg . id ] . present?
if reg . present? && @guests [ reg . id ] . present?
@ -798,6 +846,87 @@ class ConferenceAdministrationController < ApplicationController
return false
return false
end
end
def admin_update_group_ride
params [ :group_ride_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :group_ride_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_housing_info
params [ :housing_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :housing_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_workshop_info
params [ :workshop_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :workshop_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_schedule_info
params [ :schedule_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :schedule_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_travel_info
params [ :travel_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :travel_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_city_info
params [ :city_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :city_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_what_to_bring
params [ :what_to_bring ] . each do | locale , value |
@this_conference . set_column_for_locale ( :what_to_bring , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_volunteering_info
params [ :volunteering_info ] . each do | locale , value |
@this_conference . set_column_for_locale ( :volunteering_info , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_additional_details
params [ :additional_details ] . each do | locale , value |
@this_conference . set_column_for_locale ( :additional_details , locale , html_value ( value ) )
end
@this_conference . save
set_success_message @admin_step
return false
end
def admin_update_poster
def admin_update_poster
begin
begin
@this_conference . poster = params [ :poster ]
@this_conference . poster = params [ :poster ]
@ -902,7 +1031,9 @@ class ConferenceAdministrationController < ApplicationController
registration . send ( " #{ key . to_s } = " , value . present? ? Date . parse ( value ) : nil )
registration . send ( " #{ key . to_s } = " , value . present? ? Date . parse ( value ) : nil )
when :companion_email
when :companion_email
registration . housing_data || = { }
registration . housing_data || = { }
registration . housing_data [ 'companions' ] = [ value ]
registration . housing_data [ 'companion' ] || = { }
registration . housing_data [ 'companion' ] [ 'email' ] = value
registration . housing_data [ 'companion' ] [ 'id' ] = User . find_user ( value )
when :preferred_language
when :preferred_language
registration . user . locale = value
registration . user . locale = value
user_changed = true
user_changed = true
@ -1004,7 +1135,7 @@ class ConferenceAdministrationController < ApplicationController
do_404
do_404
end
end
return true
return nil
end
end
def admin_update_broadcast
def admin_update_broadcast