ish_manager 0.1.8.293 → 0.1.8.294

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: 003ba4fc5ca38c36425d1f37b39d8b20b1867ce3fb40d335981f5642b056107a
4
- data.tar.gz: 07f4a1584f2e74dca16ba689bc21191db95b70110f03fb50235852f25bf88ad2
3
+ metadata.gz: 10efaa6d13f13e13e3f52df8ec0f7ab53a181e8e91c56cfa06f22155275c9fa6
4
+ data.tar.gz: cf51a5eeaf45dfaf848c1a86b4d18fdeff58484589c7195dab89d6c7ac4412c2
5
5
  SHA512:
6
- metadata.gz: e18578b798026116b629a2a00c0c928175d07ea0ee6e9bc8dfafcbeaac09942b589737edcb15270ac1cd4f5a851bb187116c334f7a972294db793d9ff5101c4b
7
- data.tar.gz: 8ddbc3c909e71fc40df9695fe98f963b833ee07973162f9452e9fd68c549c3ec9081b315eedc6417a63d2b55be8af46ef7dc87da91e97156e55739ab0fb9a70c
6
+ metadata.gz: dd315d76a411fcdb406f2c37bce0961fc2a8a9dafbb61c758f6235e8c42c479793538d20dd46c13c3386caadf292d95ac16dedf0caeeb3f7e041f95fdbf6eb93
7
+ data.tar.gz: d719654b830ef000c0cfad3d4a582503a12b041c1da70f04c747045d7761a9a42ac5c3748d4e3af0408603f2c2f827fb26a1394ae75d5355c7d027c360210104
@@ -51,6 +51,9 @@ class IshManager::MapsController < IshManager::ApplicationController
51
51
  send_data result
52
52
  end
53
53
 
54
+ ##
55
+ ## @TODO: move to models, yes?
56
+ ##
54
57
  def import
55
58
  authorize! :create, Map
56
59
 
@@ -65,11 +68,17 @@ class IshManager::MapsController < IshManager::ApplicationController
65
68
  contents = JSON.parse contents
66
69
  contents.deep_symbolize_keys!
67
70
 
71
+ ## Delete existing
68
72
  if params[:delete_existing]
69
73
  map_ids = contents[:maps].map { |m| m[:_id] }
70
- Map.where( :_id.in => map_ids ).destroy_all
71
-
72
74
  marker_ids = contents[:markers].map { |m| m[:_id] }
75
+
76
+ maps = Map.where( :_id.in => map_ids )
77
+ maps.each do |m|
78
+ marker_ids += m.markers.map(&:_id)
79
+ end
80
+ maps.destroy_all
81
+
73
82
  Marker.where( :_id.in => marker_ids ).destroy_all
74
83
  end
75
84
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.293
4
+ version: 0.1.8.294
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox