Fixed registration status issues
This commit is contained in:
+9
-1
@@ -50,6 +50,14 @@ class City < ActiveRecord::Base
|
||||
return translation
|
||||
end
|
||||
|
||||
def to_s
|
||||
([
|
||||
city,
|
||||
territory.present? && country.present? ? I18n.t("geography.subregions.#{country}.#{territory}") : '',
|
||||
country.present? ? I18n.t("geography.countries.#{country}") : ''
|
||||
] - ['', nil]).join(', ')
|
||||
end
|
||||
|
||||
def self.search(str)
|
||||
cache = CityCache.search(str)
|
||||
|
||||
@@ -66,7 +74,7 @@ class City < ActiveRecord::Base
|
||||
|
||||
# if we didn't find a match by place id, collect the city, territory, and country from the result
|
||||
unless city.present?
|
||||
# google nsames things differently than we do, we'll look for these itesm
|
||||
# google names things differently than we do, we'll look for these items
|
||||
component_alises = {
|
||||
'locality' => :city,
|
||||
'administrative_area_level_1' => :territory,
|
||||
|
||||
@@ -34,9 +34,10 @@ class ConferenceRegistration < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def status(was = false)
|
||||
return :unregistered if user.nil? || user.firstname.blank? || self.send(was ? :city_was : :city).blank?
|
||||
return :registered if self.send(was ? :housing_was : :housing).present? || (self.send(was ? :can_provide_housing_was : :can_provide_housing) && (self.send(was ? :housing_data_was : :housing_data) || {})['availability'].present?)
|
||||
return :preregistered
|
||||
return :unregistered if user.nil?
|
||||
steps = ((was ? steps_completed_was : steps_completed) || []).map(&:to_sym)
|
||||
return :registered if steps.include?(:hosting) || steps.include?(:questions)
|
||||
return :preregistered if steps.include?(:contact_info)
|
||||
end
|
||||
|
||||
around_update :check_status
|
||||
|
||||
Reference in New Issue
Block a user