caboose-rets 0.1.116 → 0.1.117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/caboose_rets/rets_importer.rb +16 -0
- data/lib/caboose_rets/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcce4abe5bdfb3ccd77c9aa364df45c7abfbbad8dfedc7d2ce080b4cac2b308e
|
4
|
+
data.tar.gz: 5bfb5e9d4fbdaa4dfbc55135fb9f8e4a4264adb36f9af3ef8f16e9790a26370c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f9cd28f231ded10fd592a312276322ae1edbec0c0b7f71a9dbcff21f3af952dec45545f0d1cae415db416af1dc84e33a1b0238c4a53519a88002f5e560442a
|
7
|
+
data.tar.gz: 27c2ef85efade1b85f65463366548ee70299f80be1e5fcbc5a379fb0d3166c34555c295b7f593f09e7de4228fd1a7bdd79d9a963de426e9c913511e42068698f
|
@@ -547,6 +547,22 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
|
|
547
547
|
self.log3(class_type,nil,"Local IDs found: #{local_ids.to_s}")
|
548
548
|
ids_to_remove = local_ids - ids
|
549
549
|
self.log3(class_type,nil,"Found #{ids_to_remove.count} #{class_type} records in the local database that are not in the remote database.")
|
550
|
+
|
551
|
+
|
552
|
+
# Delete all RetsMedia and CabooseMedia for the deleted property listings
|
553
|
+
if class_type == 'Property' && ids_to_remove && ids_to_remove.count > 0
|
554
|
+
self.log3(class_type,nil,"Deleting Media objects that shouldn't be there...")
|
555
|
+
muis = CabooseRets::Property.where("#{k} in (?)", ids_to_remove).pluck(:matrix_unique_id)
|
556
|
+
if muis && muis.count > 0
|
557
|
+
CabooseRets::Media.where("media_mui in (?)", muis).each do |med|
|
558
|
+
self.log3("Media",med.id,"Deleting old RetsMedia #{med.id} and CabooseMedia #{med.media_id}...")
|
559
|
+
m = Caboose::Media.where(:id => med.media_id).where("name ILIKE ?","rets_media%").first
|
560
|
+
m.destroy if m
|
561
|
+
med.destroy
|
562
|
+
end
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
550
566
|
self.log3(class_type,nil,"Deleting #{class_type} records in the local database that shouldn't be there...")
|
551
567
|
query = ["delete from #{t} where #{k} in (?)", ids_to_remove]
|
552
568
|
ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
|
data/lib/caboose_rets/version.rb
CHANGED