caboose-rets 0.1.170 → 0.1.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8960b969ed670f61c2d58c28d62d0a10e080e7692ec59c270dde4fc88f67090b
|
4
|
+
data.tar.gz: 38d0d7eafd2386206d81ad6297efbe3c717d1de5c9f7b9e106690467b6196e6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0891b4f4f5c3a330213b346e3deedb6be2d7a5c5055f4b6d87b06de5d0f1f9608ea85f88a537b94e4c07afcdb02828420e7985f840f27479a03d59034dfc359
|
7
|
+
data.tar.gz: 48c711d74948e0470f2dcf2a612cccc5cb19856f42170a2d1c48ba1753c45f7eba92e7b5bc8c4800c1b8736541131b26933cbec9feceb4b79996a3d10d0a8c1a
|
@@ -22,10 +22,26 @@ module CabooseRets
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
where = "(id is not null)"
|
25
|
+
search_options = []
|
26
|
+
|
25
27
|
if (@site && @site.id == 558) || request.original_fullpath =~ /^\/tuscaloosa-condos-for-sale(.*?)$/
|
26
28
|
where = "(style ILIKE '%condo%' OR res_style ILIKE '%condo%' OR property_subtype ILIKE '%condo%' OR property_subtype ILIKE '%townhouse%')"
|
27
29
|
end
|
28
|
-
|
30
|
+
|
31
|
+
if params[:location_query] && !params[:location_query].blank?
|
32
|
+
lc = params[:location_query]
|
33
|
+
if lc && lc.count > 0
|
34
|
+
lc.each do |lcid|
|
35
|
+
so = CabooseRets::SearchOption.where(:id => lcid).first
|
36
|
+
if so
|
37
|
+
search_options << "(#{so.field} = '#{so.value}')"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
where2 = search_options.blank? ? "(id is not null)" : ("(" + search_options.join(' OR ') + ")")
|
44
|
+
|
29
45
|
sortby = @site && @site.id == 558 ? "original_entry_timestamp" : CabooseRets::default_property_sort
|
30
46
|
@saved_properties = CabooseRets::SavedProperty.where(:user_id => logged_in_user.id).pluck(:mls_number)
|
31
47
|
@pager = Caboose::PageBarGenerator.new(params, {
|
@@ -63,23 +79,26 @@ module CabooseRets
|
|
63
79
|
'foreclosure_yn' => '',
|
64
80
|
'address_like' => '',
|
65
81
|
'street_name_like' => '',
|
66
|
-
'street_number_like'
|
82
|
+
'street_number_like' => '',
|
67
83
|
'postal_code' => '',
|
68
|
-
'postal_code_like' => '',
|
84
|
+
'postal_code_like' => '',
|
69
85
|
'status' => 'Active'
|
70
86
|
},{
|
71
87
|
'model' => 'CabooseRets::Property',
|
72
88
|
'sort' => sortby,
|
73
89
|
'desc' => true,
|
74
90
|
'abbreviations' => {
|
75
|
-
|
91
|
+
'address_like' => 'street_number_concat_street_dir_prefix_concat_street_name_concat_street_suffix_concat_street_dir_suffix_like'
|
76
92
|
},
|
77
93
|
'skip' => ['status'],
|
94
|
+
'additional_params' => ['location_query'],
|
78
95
|
'base_url' => base_url,
|
79
96
|
'items_per_page' => 10,
|
80
|
-
'additional_where' => [ where ]
|
97
|
+
'additional_where' => [ where, where2 ]
|
81
98
|
})
|
82
99
|
|
100
|
+
@pager.original_params[:test] == "hey"
|
101
|
+
|
83
102
|
@properties = @pager.items
|
84
103
|
if params[:waterfronts].present? then @properties = @properties.reject{|p| p.waterfronts.blank?} end
|
85
104
|
# if params[:ftr_lotdesc] == 'golf' then @properties.reject!{|p| p.ftr_lotdesc != 'golf'} end
|
@@ -696,7 +696,6 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
696
696
|
end
|
697
697
|
self.log2("Locking task...")
|
698
698
|
task_started = self.lock_task
|
699
|
-
|
700
699
|
begin
|
701
700
|
overlap = 2.hours
|
702
701
|
if (DateTime.now - self.last_purged).to_f >= 0.5
|
@@ -717,7 +716,6 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
717
716
|
self.log2("Unlocking task if last updated...")
|
718
717
|
self.unlock_task_if_last_updated(task_started)
|
719
718
|
end
|
720
|
-
|
721
719
|
# Start the same update process in 20 minutes
|
722
720
|
self.log3(nil,nil,"Adding the update rets task for 20 minutes from now...")
|
723
721
|
q = "handler like '%update_rets%'"
|
@@ -727,6 +725,8 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
727
725
|
end
|
728
726
|
# Delete old logs
|
729
727
|
CabooseRets::Log.where("timestamp < ?",(DateTime.now - 30.days)).destroy_all
|
728
|
+
# Update search options
|
729
|
+
CabooseRets::SearchOption.delay(:queue => "rets").update_search_options
|
730
730
|
end
|
731
731
|
|
732
732
|
def self.last_updated
|
@@ -17,9 +17,7 @@ class CabooseRets::SearchOption < ActiveRecord::Base
|
|
17
17
|
'Neighborhood' => ['subdivision'],
|
18
18
|
'Street Name' => ['street_name'],
|
19
19
|
'Property Type' => ['property_type'],
|
20
|
-
'MLS Number' => ['mls_number']
|
21
|
-
#'feature',
|
22
|
-
#'location',
|
20
|
+
'MLS Number' => ['mls_number']
|
23
21
|
}
|
24
22
|
names.each do |name, fields|
|
25
23
|
fields.each do |field|
|
@@ -32,11 +30,11 @@ class CabooseRets::SearchOption < ActiveRecord::Base
|
|
32
30
|
end
|
33
31
|
|
34
32
|
def self.update_search_options_for_field(name, field)
|
35
|
-
q = ["select distinct(#{field}) from rets_properties where
|
33
|
+
q = ["select distinct(#{field}) from rets_properties where status = ?", 'Active']
|
36
34
|
rows = ActiveRecord::Base.connection.select_rows(ActiveRecord::Base.send(:sanitize_sql_array, q))
|
37
35
|
rows.each do |row|
|
38
36
|
so = self.where(:name => name, :field => field, :value => row[0]).first
|
39
|
-
if so.nil?
|
37
|
+
if so.nil? && !field.blank?
|
40
38
|
self.create(:name => name, :field => field, :value => row[0])
|
41
39
|
else
|
42
40
|
so.flag_for_delete = false
|
@@ -47,12 +45,12 @@ class CabooseRets::SearchOption < ActiveRecord::Base
|
|
47
45
|
|
48
46
|
def self.results(str, count_per_name = 10)
|
49
47
|
q = ["select * from (
|
50
|
-
select name, field, value, row_number() over (partition by name order by field) as rownum
|
48
|
+
select id, name, field, value, row_number() over (partition by name order by field) as rownum
|
51
49
|
from rets_search_options
|
52
50
|
where lower(value) like ?
|
53
51
|
) tmp where rownum < #{count_per_name}", "%#{str}%"]
|
54
52
|
rows = ActiveRecord::Base.connection.select_rows(ActiveRecord::Base.send(:sanitize_sql_array, q))
|
55
|
-
arr = rows.collect{ |row| { :
|
53
|
+
arr = rows.collect{ |row| { :id => row[0].to_i, :name => row[1], :field => row[2], :text => row[3] }}
|
56
54
|
return arr
|
57
55
|
end
|
58
56
|
|
data/lib/caboose_rets/version.rb
CHANGED
data/lib/tasks/caboose_rets.rake
CHANGED
@@ -283,9 +283,7 @@ namespace :caboose_rets do
|
|
283
283
|
end
|
284
284
|
CabooseRets::RetsImporter.log("Updating rets data...")
|
285
285
|
task_started = lock_task
|
286
|
-
|
287
286
|
begin
|
288
|
-
# RetsImporter.update_all_after(last_updated - Rational(1,86400))
|
289
287
|
CabooseRets::RetsImporter.update_after(last_updated, true)
|
290
288
|
save_last_updated(task_started)
|
291
289
|
unlock_task
|
@@ -294,6 +292,7 @@ namespace :caboose_rets do
|
|
294
292
|
ensure
|
295
293
|
unlock_task_if_last_updated(task_started)
|
296
294
|
end
|
295
|
+
CabooseRets::SearchOption.delay(:queue => "rets").update_search_options
|
297
296
|
end
|
298
297
|
|
299
298
|
def last_updated
|
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.
|
4
|
+
version: 0.1.171
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caboose-cms
|
@@ -162,7 +162,7 @@ homepage: http://github.com/williambarry007/caboose-rets
|
|
162
162
|
licenses:
|
163
163
|
- MIT
|
164
164
|
metadata: {}
|
165
|
-
post_install_message:
|
165
|
+
post_install_message:
|
166
166
|
rdoc_options: []
|
167
167
|
require_paths:
|
168
168
|
- lib
|
@@ -177,9 +177,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: '0'
|
179
179
|
requirements: []
|
180
|
-
rubyforge_project:
|
180
|
+
rubyforge_project:
|
181
181
|
rubygems_version: 2.7.8
|
182
|
-
signing_key:
|
182
|
+
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Library to download RETS data to a local website.
|
185
185
|
test_files:
|