Browse Source

Fixed registration status detection

development
Godwin 8 years ago
parent
commit
6f6dfaa830
  1. 2
      app/controllers/conferences_controller.rb
  2. 11
      app/helpers/application_helper.rb

2
app/controllers/conferences_controller.rb

@ -579,7 +579,7 @@ class ConferencesController < ApplicationController
id: r.id,
name: user.firstname || '',
email: user.email || '',
status: (view_context._"articles.conference_registration.terms.registration_status.#{(steps.include? 'questions') ? 'registered' : ((steps.include? 'contact_info') ? 'preregistered' : 'unregistered')}"),
status: (view_context._"articles.conference_registration.terms.registration_status.#{view_context.registration_status(r)}"),
is_attending: (view_context._"articles.conference_registration.questions.bike.#{r.is_attending == 'n' ? 'no' : 'yes'}"),
is_subscribed: user.is_subscribed == false ? (view_context._'articles.conference_registration.questions.bike.no') : '',
date: r.created_at ? r.created_at.strftime("%F %T") : '',

11
app/helpers/application_helper.rb

@ -243,6 +243,12 @@ module ApplicationHelper
}[@this_conference.registration_status]
end
def registration_status(registration)
return :unregistered if registration.nil? || registration.user.firstname.blank? || registration.city.blank?
return :registered if registration.housing.present? || (registration.can_provide_housing && registration.housing_data.present? && registration.housing_data['availability'].present?)
return :preregistered
end
def sortable(objects, id = 'id', url: nil, &block)
result = '<ul class="sortable sortable-' + objects[0].class.name.underscore.gsub('_', '-') + (url ? ('" data-url="' + url) : '') + '" data-id="' + id + '">'
objects.each_index do |i|
@ -902,7 +908,7 @@ module ApplicationHelper
end
when :pre_registered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user if ((r.steps_completed || []).include? 'contact_info') && r.user.present? && r.is_attending != 'n'
users << r.user if registration_status(r) == :preregistered && r.is_attending != 'n'
end
when :workshop_facilitators
user_hash = {}
@ -914,7 +920,7 @@ module ApplicationHelper
users = user_hash.values
when :unregistered
ConferenceRegistration.where(conference_id: conference.id).each do | r |
users << r.user unless ((r.steps_completed || []).include? (conference.registration_status == :open ? 'questions' : 'contact_info')) || r.user.nil? || r.is_attending == 'n'
users << r.user if registration_status(r) == :unregistered && r.is_attending != 'n'
end
when :housing_providers
ConferenceRegistration.where(conference_id: conference.id, can_provide_housing: true).each do | r |
@ -1101,7 +1107,6 @@ module ApplicationHelper
return :other_space
end
# xxx
return :other_host
end

Loading…
Cancel
Save