caboose-rets 0.1.104 → 0.1.105

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c9f8f8ef18191947db277c8ea22243b27337bfed20e0d3f3076d1bce66522b2
4
- data.tar.gz: b75b6ed965b3dceaf571dbcf864c7da5ea065d1d6484018608319f3b6956bb84
3
+ metadata.gz: 48edc2bbcfb4c54113811728c9c7bed5710a08739951ee8079ddf36f5d36d319
4
+ data.tar.gz: 56e1f5796dbf9cc164bd2fcce891a283f8d4b3968ccbced89863b7c660938827
5
5
  SHA512:
6
- metadata.gz: 0ac0dbc25e46f552a1a6915c8021ae9a5ef6751758cf873e430a967d025a04547c41d90131f14355d9943a40e0a410f1564f0aa337211d45c88636fd76490230
7
- data.tar.gz: 9f067c17ce63d3bf9c94dddb9dfc58ad3878556f94c608fbfa351d8e66892fb5a44bc77709c65a9e17fc9582fe314649004af04d8de11c71d1bff5b0fe866f0a
6
+ metadata.gz: 7336df1551ab2cbd64dc2a7cc46b0993a7899d97563551a5d31b3003282964e25d4a1ec07b2147702d705f24f54c325e1b8bf390d62366c827c93d38748a7f71
7
+ data.tar.gz: 6f0ca4982adac71bff01008c6d5f395520097f49dde89066b2f3f544a7dfc1a8116d6c8bb3c02a19cba1f15d8e21a0ed2e2c7b9b3d94727e595eb9fb8a3e029c
@@ -98,6 +98,23 @@ module CabooseRets
98
98
  @property = Property.where(:mls_number => params[:mls_number]).first
99
99
  @agent = Agent.where(:matrix_unique_id => @property.list_agent_mui).where("office_mls_id ILIKE ?", @site.rets_office_id).first if @property
100
100
  @saved = logged_in? && SavedProperty.where(:user_id => logged_in_user.id, :mls_number => params[:mls_number]).exists?
101
+
102
+ price_where = "list_price is not null and (list_price >= ? AND list_price <= ?)"
103
+ beds_where = "beds_total is not null and (beds_total >= ? AND beds_total <= ?)"
104
+ price_min = @property.list_price * 0.8 if @property
105
+ price_max = @property.list_price * 1.2 if @property
106
+ beds_min = @property.beds_total - 2 if @property
107
+ beds_max = @property.beds_total + 2 if @property
108
+
109
+ # price_min2 = @property.list_price * 0.5 if @property
110
+ # price_max2 = @property.list_price * 1.5 if @property
111
+ # beds_min2 = @property.beds_total - 3 if @property
112
+ # beds_max2 = @property.beds_total + 3 if @property
113
+
114
+ @related = Property.near("#{@property.latitude}, #{@property.longitude}", 50).where(:property_type => @property.property_type, :status => 'Active', :property_subtype => @property.property_subtype).where(price_where,price_min,price_max).where(beds_where,beds_min,beds_max).where("mls_number != ?",@property.mls_number).order('distance asc').limit(3) if @property
115
+ #@related = Property.near("#{@property.latitude}, #{@property.longitude}", 20).where(:property_type => @property.property_type, :status => 'Active', :property_subtype => @property.property_subtype).where(price_where,price_min2,price_max2).where(beds_where,beds_min2,beds_max2).where("mls_number != ?",@property.mls_number).order('distance asc').limit(3) if @property && @related.count == 0
116
+
117
+
101
118
  if @property.nil?
102
119
  @mls_number = params[:mls_number]
103
120
  # CabooseRets::RetsImporter.delay(:priority => 10, :queue => 'rets').import_property(@mls_number.to_i)
@@ -2,6 +2,8 @@ class CabooseRets::Property <ActiveRecord::Base
2
2
  self.table_name = "rets_properties"
3
3
  attr_accessible :id, :matrix_unique_id, :mls_number, :alternate_link
4
4
 
5
+ geocoded_by :full_address
6
+
5
7
  def url() return "/properties/#{self.mls_number}/details" end
6
8
  def images() return CabooseRets::Media.where(:media_mui => self.matrix_unique_id, :media_type => 'Photo').reorder(:media_order).all end
7
9
  def files() return CabooseRets::Media.where(:media_mui => self.matrix_unique_id, :media_type => 'File' ).reorder(:media_order).all end
@@ -183,7 +183,7 @@ class CabooseRets::Schema < Caboose::Utilities::Schema
183
183
  [ :interior_features , :text],
184
184
  [ :land_features_extras , :text],
185
185
  [ :landscaping , :text],
186
- [ :latitude , :text],
186
+ [ :latitude , :decimal],
187
187
  [ :laundry , :text],
188
188
  [ :legal_description , :text],
189
189
  [ :legal_lot , :text],
@@ -200,7 +200,7 @@ class CabooseRets::Schema < Caboose::Utilities::Schema
200
200
  [ :list_office_name , :text],
201
201
  [ :list_office_phone , :text],
202
202
  [ :list_price , :decimal],
203
- [ :longitude , :text],
203
+ [ :longitude , :decimal],
204
204
  [ :lot_description , :text],
205
205
  [ :lot_dimensions , :text],
206
206
  [ :lot_dim_source , :text],
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.1.104'
2
+ VERSION = '0.1.105'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-rets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.104
4
+ version: 0.1.105
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-04 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: geocoder
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Library to download RETS data to a local website for easy use.
28
42
  email:
29
43
  - william@nine.is