Skip to content

Commit

Permalink
update lead model
Browse files Browse the repository at this point in the history
  • Loading branch information
bemky committed Nov 29, 2016
1 parent 5f87d71 commit e1d019d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/mls/account.rb
Expand Up @@ -13,6 +13,7 @@ class Account < MLS::Model
has_many :coworking_spaces, through: :ownerships, source: :asset, source_type: 'CoworkingSpace'
has_many :listings, through: :ownerships, source: :asset, source_type: 'Listing', inverse_of: :accounts
has_many :email_digests
has_many :subscriptions, as: :subject

has_many :credit_cards

Expand Down
4 changes: 2 additions & 2 deletions lib/mls/inquiry.rb
@@ -1,7 +1,7 @@
class Inquiry < MLS::Model

has_many :emails
belongs_to :lead
has_many :leads
belongs_to :subject, polymorphic: true
belongs_to :account

Expand Down Expand Up @@ -39,7 +39,7 @@ def account_attributes=(account_attrs)
accnt
end
end

def self.by_day(filter)
req = Net::HTTP::Get.new("/inquiries/by_day")
req.body = {
Expand Down
6 changes: 1 addition & 5 deletions lib/mls/lead.rb
@@ -1,10 +1,6 @@
class Lead < MLS::Model

belongs_to :account
belongs_to :agent, class_name: "Account"

has_many :recommendations
# Removing lead_listings after recommendations release
has_many :lead_listings
belongs_to :inquiry

end
4 changes: 4 additions & 0 deletions lib/mls/listing.rb
Expand Up @@ -120,6 +120,10 @@ def rate(units=nil)
price.round(2)
end

def regions
Region.where(:id => self.region_ids)
end

def longitude
location.x
end
Expand Down

0 comments on commit e1d019d

Please sign in to comment.