caboose-rets 0.1.194 → 0.1.195

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: 717549d5caee57e9d595416f881f671f6d825974d668c42124ec090e076dcf8f
4
- data.tar.gz: 78580df8a826fea84e4ee8a8e5c6675a4498200512e789c45067bb27f5f438b5
3
+ metadata.gz: 9c32977a4700cd7eb4bf3705dda1ccfdcc755ede9b9856844264258e5a81a703
4
+ data.tar.gz: 3348335c0ad5ebc589830854bc6030215b7825effc32343a2362669923f4ae5b
5
5
  SHA512:
6
- metadata.gz: 86c3239a35da2a4cccd1ba91980c327c94c7b74487f69ac658b7111f8eb144e7247f1ea8c4c0c50c89e8f92ceb53932411004b1982d0a21b8ff1102983d15e64
7
- data.tar.gz: 01f6fb7047bfa2924009c32d303303cce4dba1d15d389b2470d02dc82abadd60f3685a28cb3cc24dbf45a4ff8e9520f3a875c4ad164dc2efb32ef933c6d3e5f1
6
+ metadata.gz: 34f40bba01f5fa570db421b465313b7386d4acab24ff69cd3ec8bfa8e8780f2cc2efb956c0d5131facd1362815c2bf513c7b886d580e4681f2358d9e91254ae1
7
+ data.tar.gz: dfe6230980c21660282605f3612aa3e21899dc2dc95d39f9a982cca2644b42faee4df5f8e8333c97b2ac504504c541bfd0bfc50d89ac464bf20388ccae4ee7b5
@@ -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
- 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
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
- 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
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
- 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
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)