Workshop auth fixes and better error reporting

This commit is contained in:
Godwin
2017-07-19 20:29:25 -07:00
parent c21cc05c99
commit e8ca73a801
20 changed files with 371 additions and 332 deletions
+15 -15
View File
@@ -59,8 +59,8 @@ module AdminHelper
def get_administration_group(administration_step)
admin_step = administration_step.to_sym
admin_step = administration_sub_steps[admin_step] if administration_sub_steps[admin_step].present?
administration_steps.each do | group, steps |
steps.each do | step |
administration_steps.each do |group, steps|
steps.each do |step|
return group if step == admin_step
end
end
@@ -75,35 +75,35 @@ module AdminHelper
case to.to_sym
when :registered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user if ((r.steps_completed || []).include? 'questions') && r.user.present? && r.is_attending != 'n'
ConferenceRegistration.where(conference_id: conference.id).each do |r|
users << r.user if r.registered? && r.user.present? && r.attending?
end
when :pre_registered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user if registration_status(r) == :preregistered && r.is_attending != 'n'
ConferenceRegistration.where(conference_id: conference.id).each do |r|
users << r.user if r.attending?
end
when :workshop_facilitators
user_hash = {}
Workshop.where(conference_id: conference.id).each do | w |
w.active_facilitators.each do | u |
Workshop.where(conference_id: conference.id).each do |w|
w.active_facilitators.each do |u|
user_hash[u.id] ||= u if u.present?
end
end
users = user_hash.values
when :unregistered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user if registration_status(r) == :unregistered && r.is_attending != 'n'
ConferenceRegistration.where(conference_id: conference.id).each do |r|
users << r.user if !r.registered? && r.attending?
end
when :housing_providers
ConferenceRegistration.where(conference_id: conference.id, can_provide_housing: true).each do | r |
ConferenceRegistration.where(conference_id: conference.id, can_provide_housing: true).each do |r|
users << r.user if r.user.present?
end
when :guests
ConferenceRegistration.where(conference_id: conference.id, housing: 'house').each do | r |
users << r.user if r.user.present? && r.is_attending != 'n'
ConferenceRegistration.where(conference_id: conference.id, housing: 'house').each do |r|
users << r.user if r.user.present? && r.attending?
end
when :all
User.all.each do | u |
User.all.each do |u|
users << u if u.present? && (u.is_subscribed.nil? || u.is_subscribed)
end
end
@@ -151,7 +151,7 @@ module AdminHelper
end
end
(((((@schedule[@day] || {})[:times] || {})[@time] || {})[:item] || {})[:workshops] || {}).each do | l, w |
(((((@schedule[@day] || {})[:times] || {})[@time] || {})[:item] || {})[:workshops] || {}).each do |l, w|
if w[:workshop].id != workshop.id
f_a = w[:workshop].active_facilitators.map { | f | f.id }
f_b = workshop.active_facilitators.map { | f | f.id }
+1 -45
View File
@@ -704,58 +704,14 @@ module FormHelper
return options
end
def registration_step_menu
steps = current_registration_steps(@registration)
return '' unless steps.present? && steps.length > 1
pre_registration_steps = ''
post_registration_steps = ''
post_registration = false
steps.each do |step|
text = _"articles.conference_registration.headings.#{step[:name].to_s}"
if step[:name] == :workshops
post_registration = true
end
h = content_tag :li, class: [step[:enabled] ? :enabled : nil, @register_template == step[:name] ? :current : nil, post_registration ? :post : :pre].compact do
if step[:enabled]
content_tag :div, (link_to text, register_step_path(@this_conference.slug, step[:name])).html_safe, class: :step
else
content_tag :div, text, class: :step
end
end
if post_registration
post_registration_steps += h.html_safe
else
pre_registration_steps += h.html_safe
end
end
html = (
row class: 'flow-steps' do
columns do
(content_tag :ul, id: 'registration-steps' do
pre_registration_steps.html_safe +
post_registration_steps.html_safe
end).html_safe
end
end
)
return html.html_safe
end
def broadcast_options(conference = nil)
conference ||= @this_conference || @conference
options = [
:registered,
:pre_registered,
:workshop_facilitators,
:unregistered,
:workshop_facilitators,
:housing_providers,
:guests,
:all