lib/flapjack/data/contact.rb in flapjack-0.6.39 vs lib/flapjack/data/contact.rb in flapjack-0.6.40
- old
+ new
@@ -22,11 +22,11 @@
k =~ /^contact:(\d+)$/
id = $1
contact = self.find_by_id(id, :redis => redis)
ret << contact if contact
ret
- }
+ }.sort_by {|c| [c.last_name, c.first_name]}
end
def self.delete_all(options = {})
raise "Redis connection not set" unless redis = options[:redis]
@@ -38,9 +38,11 @@
def self.find_by_id(id, options = {})
raise "Redis connection not set" unless redis = options[:redis]
raise "No id value passed" unless id
logger = options[:logger]
+
+ return unless redis.hexists("contact:#{id}", 'first_name')
fn, ln, em = redis.hmget("contact:#{id}", 'first_name', 'last_name', 'email')
me = redis.hgetall("contact_media:#{id}")
# similar to code in instance method pagerduty_credentials