Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix regions bug to return empty array for number without region.

  • Loading branch information...
commit 1600d7dc62ab1fb7d3a18e3d750b866b7b2620f0 1 parent 2243118
Willa authored
View
2  lib/crowdring/crowdring.rb
@@ -22,7 +22,7 @@ def self.service_handler
configure :development do
register Sinatra::Reloader
- service_handler.add('logger', LoggingService.new(['+18001111111', '+18002222222', '+919102764614','+27114891907'], output: true), default: true)
+ service_handler.add('logger', LoggingService.new(['+18001111111', '+18002222222', '+911111111111', '+919102764614','+27114891907'], output: true), default: true)
end
configure :production do
View
5 lib/crowdring/number_pool.rb
@@ -24,7 +24,6 @@ def initialize
used_voice_numbers = AssignedVoiceNumber.all.map(&:phone_number)
avail_voice_numbers = CompositeService.instance.voice_numbers - used_voice_numbers
@voice_numbers = avail_voice_numbers.map {|n| Phoner::Phone.parse n }
-
used_sms_numbers = AssignedSMSNumber.all.map(&:phone_number)
avail_sms_numbers = CompositeService.instance.sms_numbers - used_sms_numbers
@sms_numbers = avail_sms_numbers.map{|n| Phoner::Phone.parse n}
@@ -37,7 +36,7 @@ def summary(type)
def summary_with_numbers(type)
- numbers = numbers_of_type(type)
+ numbers = numbers_of_type(type).compact
region_summary = numbers.reduce({}) do |summary, number|
country = number.country.name
regions = Regions.strs_for(number).join(', ')
@@ -53,7 +52,7 @@ def summary_with_numbers(type)
summary
end
- region_summary.values
+ Hash[region_summary.sort].values
end
def find_numbers(opts, type)
View
2  lib/crowdring/regions.rb
@@ -18,7 +18,7 @@ def tags_for(number)
def strs_for(number)
regions = region_hash[number.country.name.downcase]
- regions ? regions[number.area_code.to_i] : []
+ regions && regions[number.area_code.to_i] || []
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.