caboose-rets 0.1.194 → 0.1.196
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/caboose_rets/properties_controller.rb +1 -1
- data/app/models/caboose_rets/media.rb +74 -74
- data/app/models/caboose_rets/rets_importer.rb +223 -143
- data/app/models/caboose_rets/rets_importer_old.rb +622 -0
- data/lib/caboose_rets/version.rb +1 -1
- data/lib/tasks/caboose_rets.rake +8 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e25407e4d2656292fd7d5d5c8d637dcdfd3731e37caeeff3abcb7c033398358
|
4
|
+
data.tar.gz: 06bff2e64c850854f62b50a8809ba4be9bad62be3e668f4506dda3308b9c6a40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db10c7885eb8b690b3500975ccb8e0f1dea6e65af88ae5f5a905231dbbb9ce0de648b932ceda6b44b15f71452e02313774bca20ef9cdcf508c3e3da920b5bfb6
|
7
|
+
data.tar.gz: 82f649967e310399847ab549111ceec69054fc99f518e1b67bb24fd8c83eda587023c14f94d845d5df2e7b235275f0aee531483e9b2da64a234616034602d448
|
@@ -131,7 +131,7 @@ module CabooseRets
|
|
131
131
|
|
132
132
|
# @route GET /properties/:mls_number/details
|
133
133
|
def details
|
134
|
-
@property = Property.where(:mls_number => params[:mls_number]).first
|
134
|
+
@property = Property.where(:mls_number => params[:mls_number], :status => 'Active').first
|
135
135
|
@agent = Agent.where(:matrix_unique_id => @property.list_agent_mui).where("office_mls_id ILIKE ?", @site.rets_office_id).first if @property
|
136
136
|
@saved = logged_in? && SavedProperty.where(:user_id => logged_in_user.id, :mls_number => params[:mls_number]).exists?
|
137
137
|
price_where = "list_price is not null and (list_price >= ? AND list_price <= ?)"
|
@@ -47,87 +47,87 @@ class CabooseRets::Media < ActiveRecord::Base
|
|
47
47
|
|
48
48
|
def self.reorder(media_ids, bucket_name)
|
49
49
|
|
50
|
-
s3 = AWS::S3.new
|
51
|
-
b = s3.buckets[bucket_name]
|
52
|
-
|
53
|
-
# Rename the s3 assets to temp names
|
54
|
-
media_ids.each do |id|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
# Rename the assets to their new names
|
61
|
-
i = 1
|
62
|
-
j = 1
|
63
|
-
media_ids.each do |id|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
return true
|
50
|
+
# s3 = AWS::S3.new
|
51
|
+
# b = s3.buckets[bucket_name]
|
52
|
+
|
53
|
+
# # Rename the s3 assets to temp names
|
54
|
+
# media_ids.each do |id|
|
55
|
+
# m = CabooseRets::Media.find(id)
|
56
|
+
# (m.image.styles.keys+[:original]).each { |style| b.objects[m.image.path(style)].rename_to "#{m.image.path(style)}.temp" } if m.media_type == 'Photo'
|
57
|
+
# b.objects[m.file.path].rename_to "#{m.file.path}.temp" if m.media_type == 'File'
|
58
|
+
# end
|
59
|
+
|
60
|
+
# # Rename the assets to their new names
|
61
|
+
# i = 1
|
62
|
+
# j = 1
|
63
|
+
# media_ids.each do |id|
|
64
|
+
# m = CabooseRets::Media.find(id)
|
65
|
+
# if m.media_type == 'Photo'
|
66
|
+
# orig_name = "#{m.image.path}.temp"
|
67
|
+
# m.media_order = i
|
68
|
+
# (m.image.styles.keys+[:original]).each { |style| b.objects[orig_name.gsub("original", style.to_s)].rename_to m.image.path(style) }
|
69
|
+
# m.save
|
70
|
+
# i = i + 1
|
71
|
+
# elsif m.media_type == 'File'
|
72
|
+
# b.objects["#{m.file.path}.temp"].rename_to m.file.path
|
73
|
+
# m.media_order = j
|
74
|
+
# m.save
|
75
|
+
# j = j + 1
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
|
79
|
+
# return true
|
80
80
|
end
|
81
81
|
|
82
82
|
def self.reorder(media_ids, bucket_name)
|
83
83
|
|
84
|
-
s3 = AWS::S3.new
|
85
|
-
b = s3.buckets[bucket_name]
|
86
|
-
|
87
|
-
# Rename the s3 assets to temp names
|
88
|
-
media_ids.each do |id|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
# Rename the assets to their new names
|
95
|
-
i = 1
|
96
|
-
j = 1
|
97
|
-
media_ids.each do |id|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
return true
|
84
|
+
# s3 = AWS::S3.new
|
85
|
+
# b = s3.buckets[bucket_name]
|
86
|
+
|
87
|
+
# # Rename the s3 assets to temp names
|
88
|
+
# media_ids.each do |id|
|
89
|
+
# m = CabooseRets::Media.find(id)
|
90
|
+
# (m.image.styles.keys+[:original]).each { |style| b.objects[m.image.path(style)].rename_to "#{m.image.path(style)}.temp" } if m.media_type == 'Photo'
|
91
|
+
# b.objects[m.file.path].rename_to "#{m.file.path}.temp" if m.media_type == 'File'
|
92
|
+
# end
|
93
|
+
|
94
|
+
# # Rename the assets to their new names
|
95
|
+
# i = 1
|
96
|
+
# j = 1
|
97
|
+
# media_ids.each do |id|
|
98
|
+
# m = CabooseRets::Media.find(id)
|
99
|
+
# if m.media_type == 'Photo'
|
100
|
+
# orig_name = "#{m.image.path}.temp"
|
101
|
+
# m.media_order = i
|
102
|
+
# (m.image.styles.keys+[:original]).each { |style| b.objects[orig_name.gsub("original", style.to_s)].rename_to m.image.path(style) }
|
103
|
+
# m.save
|
104
|
+
# i = i + 1
|
105
|
+
# elsif m.media_type == 'File'
|
106
|
+
# b.objects["#{m.file.path}.temp"].rename_to m.file.path
|
107
|
+
# m.media_order = j
|
108
|
+
# m.save
|
109
|
+
# j = j + 1
|
110
|
+
# end
|
111
|
+
# end
|
112
|
+
|
113
|
+
# return true
|
114
114
|
end
|
115
115
|
|
116
116
|
def self.rename_media
|
117
|
-
s3 = AWS::S3.new
|
118
|
-
b = s3.buckets["advantagerealtygroup"]
|
119
|
-
|
120
|
-
CabooseRets::Media.where(:media_type => 'Photo').reorder("mls, media_order").all.each do |m|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
return true
|
117
|
+
# s3 = AWS::S3.new
|
118
|
+
# b = s3.buckets["advantagerealtygroup"]
|
119
|
+
|
120
|
+
# CabooseRets::Media.where(:media_type => 'Photo').reorder("mls, media_order").all.each do |m|
|
121
|
+
# puts "Renaming #{m.mls}_#{m.id}..."
|
122
|
+
# if m.image_file_name && m.image
|
123
|
+
# ext = File.extname(m.image_file_name)
|
124
|
+
# (m.image.styles.keys+[:original]).each do |style|
|
125
|
+
# b.objects[m.image.path(style)].copy_to "rets/media_new/#{m.id}_#{style}.#{ext}" if b.objects[m.image.path(style)].exists?
|
126
|
+
# end
|
127
|
+
# end
|
128
|
+
# end
|
129
|
+
|
130
|
+
# return true
|
131
131
|
end
|
132
132
|
|
133
133
|
def image_url(style)
|