Method: MessageRecipientQuery.friendly_name

Defined in:
app/models/message_recipient_query.rb

.friendly_name(query, model = nil) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/models/message_recipient_query.rb', line 50

def self.friendly_name(query, model = nil)
  begin
    recipient_query = parse(query, model)
    model = recipient_query.model
  rescue MessageRecipientQuery::ModelIdNotFound
    return "[invalid recipient]"
  end

  case recipient_query.type
  when "bus-list"
    "Bus List: #{model.name} (signed up passengers)"
  when "school"
    "Confirmed or Accepted: #{model.name}"
  when "blazer"
    "Blazer Query: #{model.name}"
  else
    raise "Unknown recipient query type: #{recipient_query.type.inspect} (in message recipient query: #{r.inspect}"
  end
end