caboose-rets 0.1.116 → 0.1.117

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: f294090601dfd6564470df919281b86bf4f8070397256128a3732fb7bb0cd1d2
4
- data.tar.gz: 9dc49dec8f68574d9cd04249df03c51203b6b30bc7e0266cfb249e058c6d9b5a
3
+ metadata.gz: fcce4abe5bdfb3ccd77c9aa364df45c7abfbbad8dfedc7d2ce080b4cac2b308e
4
+ data.tar.gz: 5bfb5e9d4fbdaa4dfbc55135fb9f8e4a4264adb36f9af3ef8f16e9790a26370c
5
5
  SHA512:
6
- metadata.gz: d99faf2eacf150c0f43b833dfc673e1eecb3c5a98ca3a55541dd123bc183c31c443093c8c31db6eae807ea62ebd7fa42f67702fcda38700f2c44823827bbf6b2
7
- data.tar.gz: 60dbf8a0fc5787eaa61eec63b1bb946253b1dbca44404233b3e7461fe88f47b74a025ff04924177a6c7ac8b159fca4986f26487af086ebd99453185e50e358a4
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))
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.1.116'
2
+ VERSION = '0.1.117'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-rets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.116
4
+ version: 0.1.117
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry