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 +4 -4
- data/app/controllers/ish_manager/maps_controller.rb +11 -2
- 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: 10efaa6d13f13e13e3f52df8ec0f7ab53a181e8e91c56cfa06f22155275c9fa6
|
4
|
+
data.tar.gz: cf51a5eeaf45dfaf848c1a86b4d18fdeff58484589c7195dab89d6c7ac4412c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|