Update copy, tests, and administration
This commit is contained in:
@@ -70,6 +70,17 @@ class ConferenceAdministrationController < ApplicationController
|
||||
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|
|
||||
do_403
|
||||
end
|
||||
@@ -195,7 +206,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
end
|
||||
end
|
||||
return respond_to do |format|
|
||||
format.xlsx { render xlsx: :stats, filename: "organizations" }
|
||||
format.xlsx { render xlsx: '../conferences/stats', filename: "organizations" }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -211,7 +222,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
if request.format.xlsx?
|
||||
logger.info "Generating stats.xls"
|
||||
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
|
||||
|
||||
@@ -251,7 +262,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
if request.format.xlsx?
|
||||
logger.info "Generating stats.xls"
|
||||
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
|
||||
else
|
||||
@registration_count = @registrations.size
|
||||
@@ -277,6 +288,11 @@ class ConferenceAdministrationController < ApplicationController
|
||||
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
|
||||
|
||||
@@ -354,7 +370,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
@excel_data[:data] << host_data
|
||||
end
|
||||
return respond_to do |format|
|
||||
format.xlsx { render xlsx: :stats, filename: "housing" }
|
||||
format.xlsx { render xlsx: '../conferences/stats', filename: "housing" }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -406,8 +422,8 @@ class ConferenceAdministrationController < ApplicationController
|
||||
def administrate_publish_schedule
|
||||
end
|
||||
|
||||
def get_stats(html_format = false, id = nil)
|
||||
@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 }
|
||||
def get_stats(html_format = false, id = nil, conference = @this_conference)
|
||||
@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 = {
|
||||
columns: [
|
||||
:name,
|
||||
@@ -429,7 +445,6 @@ class ConferenceAdministrationController < ApplicationController
|
||||
:food,
|
||||
:companion,
|
||||
:companion_email,
|
||||
:allergies,
|
||||
:other,
|
||||
:can_provide_housing,
|
||||
:first_day,
|
||||
@@ -448,7 +463,6 @@ class ConferenceAdministrationController < ApplicationController
|
||||
arrival: [:date, :day],
|
||||
departure: [:date, :day],
|
||||
registration_fees_paid: :money,
|
||||
allergies: :text,
|
||||
other: :text,
|
||||
first_day: [:date, :day],
|
||||
last_day: [:date, :day],
|
||||
@@ -470,7 +484,6 @@ class ConferenceAdministrationController < ApplicationController
|
||||
food: 'forms.labels.generic.food',
|
||||
companion: 'articles.conference_registration.terms.companion',
|
||||
companion_email: 'articles.conference_registration.terms.companion_email',
|
||||
allergies: 'forms.labels.generic.allergies',
|
||||
registration_fees_paid: 'articles.conference_registration.headings.fees_paid',
|
||||
other: 'forms.labels.generic.other_notes',
|
||||
can_provide_housing: 'articles.conference_registration.can_provide_housing',
|
||||
@@ -485,6 +498,11 @@ class ConferenceAdministrationController < ApplicationController
|
||||
},
|
||||
data: []
|
||||
}
|
||||
|
||||
if conference.id != @this_conference.id
|
||||
@excel_data[:columns] -= [:name, :email]
|
||||
end
|
||||
|
||||
User.AVAILABLE_LANGUAGES.each do |l|
|
||||
@excel_data[:keys]["language_#{l}".to_sym] = "languages.#{l.to_s}"
|
||||
end
|
||||
@@ -524,10 +542,9 @@ class ConferenceAdministrationController < ApplicationController
|
||||
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}") : '',
|
||||
companion: companion,
|
||||
companion_email: (housing_data['companions'] || ['']).first,
|
||||
allergies: r.allergies,
|
||||
companion_email: (housing_data['companion'] || { 'email' => ''})['email'],
|
||||
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') : '',
|
||||
first_day: availability[0].present? ? availability[0].strftime("%F %T") : '',
|
||||
last_day: availability[1].present? ? availability[1].strftime("%F %T") : '',
|
||||
@@ -677,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}")}
|
||||
end
|
||||
|
||||
companions = data['companions'] || []
|
||||
companions.each do |companion|
|
||||
user = User.find_user(companion)
|
||||
if user.present?
|
||||
if data['companion'].present?
|
||||
companion = if data['companion']['id'].present?
|
||||
User.find(data['companion']['id'])
|
||||
else
|
||||
User.find_user(data['companion']['email'])
|
||||
end
|
||||
|
||||
if companion.present?
|
||||
reg = ConferenceRegistration.find_by(
|
||||
user_id: user.id,
|
||||
user_id: companion.id,
|
||||
conference_id: @this_conference.id
|
||||
)
|
||||
if reg.present? && @guests[reg.id].present?
|
||||
@@ -1010,7 +1031,9 @@ class ConferenceAdministrationController < ApplicationController
|
||||
registration.send("#{key.to_s}=", value.present? ? Date.parse(value) : nil)
|
||||
when :companion_email
|
||||
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
|
||||
registration.user.locale = value
|
||||
user_changed = true
|
||||
@@ -1112,7 +1135,7 @@ class ConferenceAdministrationController < ApplicationController
|
||||
do_404
|
||||
end
|
||||
|
||||
return true
|
||||
return nil
|
||||
end
|
||||
|
||||
def admin_update_broadcast
|
||||
|
||||
@@ -8,7 +8,7 @@ class ConferencesController < ApplicationController
|
||||
def list
|
||||
@page_title = 'articles.conferences.headings.Conference_List'
|
||||
@conference_list = { future: [], passed: [] }
|
||||
Conference.all.order("start_date DESC").each do | conference |
|
||||
Conference.all.order("start_date DESC").each do |conference|
|
||||
if conference.is_public || conference.host?(current_user)
|
||||
@conference_list[conference.over? ? :passed : :future] << conference
|
||||
end
|
||||
@@ -337,10 +337,10 @@ class ConferencesController < ApplicationController
|
||||
if @registration.housing_data.blank?
|
||||
ConferenceRegistration.where(
|
||||
conference_id: @this_conference.id, can_provide_housing: [nil, false]
|
||||
).where.not(housing_data: nil).each do | r |
|
||||
).where.not(housing_data: nil).each do |r|
|
||||
@registration.housing_data = {
|
||||
companions: [ r.user.email ]
|
||||
} if r.housing_data['companions'].present? && r.housing_data['companions'].include?(current_user.email)
|
||||
} if r.housing_data['companion'].present? && (r.housing_data['companion']['id'] == current_user.id || r.housing_data['companion']['email'] == current_user.email)
|
||||
end
|
||||
|
||||
@registration.housing_data ||= { }
|
||||
@@ -358,7 +358,7 @@ class ConferencesController < ApplicationController
|
||||
@workshops = Array.new
|
||||
|
||||
# put wach workshop into the correct array
|
||||
Workshop.where(conference_id: @this_conference.id).each do | workshop |
|
||||
Workshop.where(conference_id: @this_conference.id).each do |workshop|
|
||||
if workshop.active_facilitator?(current_user)
|
||||
@my_workshops << workshop
|
||||
elsif workshop.requested_collaborator?(current_user)
|
||||
@@ -436,7 +436,7 @@ class ConferencesController < ApplicationController
|
||||
|
||||
def registration_complete?(registration = @registration)
|
||||
completed_steps = registration.steps_completed || []
|
||||
required_steps(registration.conference).each do | step |
|
||||
required_steps(registration.conference).each do |step|
|
||||
return true if step == :workshops
|
||||
return false unless completed_steps.include?(step.to_s)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user