layers_of_london-booth-map_tool 0.1.1 → 0.1.2.1

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: 2daab147177435f92cebb04bf6ee9257116a48411ebf1b3820ec5989d98286c0
4
- data.tar.gz: 7d52d522f8dee4ca6cd10d119cc67a5fbe207015cdb51273164427c74cd0a968
3
+ metadata.gz: 4495369b72bcfe877a3d6ef77ffb8812216250d308c8a243450fd64559060b55
4
+ data.tar.gz: 11d34c7bc762629c885a6ac34502cfecee850bcde736b872f26b4da148c35596
5
5
  SHA512:
6
- metadata.gz: 883e534dbd5892c982543b44a1d5e8d5b2d680cfc20a60e22f1e3e0de22c838f021663af45eb81b9fe3ff2b0a743034c8a06ec0ed2b0bfba7dd9a5780285e264
7
- data.tar.gz: 3484e6d0cca603529db010aab0a222f30f5dceb95bc8c6b0e0fe1ce60dbf7b9c10d5671e2fae5f53afe12963c05c487135a66baf4eba4a4751e010db35f2aece
6
+ metadata.gz: bd1ff2b16202496c6d1a6ba70f69ffac89c2b06bad2a2503b084815818e5a634285c42ac5546fecc7499ef23e236af923b8de0026c3a61d5fb36ebe6885b9b57
7
+ data.tar.gz: c98879375683029aed48d52a986232e1a2d2649b99724986c6282dbd4fa4c79280eedbce213e79b2057e0571e940d4701d3f2be93ae17f94d760c9852dda5bbd
@@ -5,7 +5,7 @@ module LayersOfLondon::Booth::MapTool
5
5
  skip_after_action :verify_authorized rescue nil
6
6
 
7
7
  def index
8
- squares = LayersOfLondon::Booth::MapTool::Square.where.not(aasm_state: :not_started)
8
+ squares = LayersOfLondon::Booth::MapTool::Square.all
9
9
  render json: {
10
10
  type: "FeatureCollection",
11
11
  features: squares.collect(&:to_geojson)
@@ -43,10 +43,7 @@ module LayersOfLondon::Booth::MapTool
43
43
  end
44
44
 
45
45
  def polygons
46
- features = LayersOfLondon::Booth::MapTool::Polygon.all.collect do |polygon|
47
- user_can_edit = LayersOfLondon::Booth::MapTool::PolygonPolicy.new(current_user, polygon).update?
48
- polygon.to_json(user_can_edit: user_can_edit)
49
- end
46
+ features = LayersOfLondon::Booth::MapTool::PolygonPolicy::Scope.new(current_user, LayersOfLondon::Booth::MapTool::Polygon).resolve
50
47
 
51
48
  feature_collection = {
52
49
  type: "FeatureCollection",
@@ -89,24 +89,24 @@ module LayersOfLondon::Booth::MapTool
89
89
  {
90
90
  type: "Feature",
91
91
  geometry: {
92
- type: "MultiPolygon",
92
+ type: "Polygon",
93
93
  coordinates: [
94
- [
94
+ # [
95
95
  [
96
- north_west_padded.to_a.reverse,
97
- south_west_padded.to_a.reverse,
98
- south_east_padded.to_a.reverse,
99
- north_east_padded.to_a.reverse,
100
- north_west_padded.to_a.reverse
101
- ],
102
- [
103
- LayersOfLondon::Booth::MapTool.configuration.north_west.to_a.reverse,
104
- LayersOfLondon::Booth::MapTool.configuration.north_east.to_a.reverse,
105
- LayersOfLondon::Booth::MapTool.configuration.south_east.to_a.reverse,
106
- LayersOfLondon::Booth::MapTool.configuration.south_west.to_a.reverse,
107
- LayersOfLondon::Booth::MapTool.configuration.north_west.to_a.reverse,
108
- ]
109
- ]
96
+ north_west.to_a.reverse,
97
+ south_west.to_a.reverse,
98
+ south_east.to_a.reverse,
99
+ north_east.to_a.reverse,
100
+ north_west.to_a.reverse
101
+ ]#,
102
+ # [
103
+ # LayersOfLondon::Booth::MapTool.configuration.north_west.to_a.reverse,
104
+ # LayersOfLondon::Booth::MapTool.configuration.north_east.to_a.reverse,
105
+ # LayersOfLondon::Booth::MapTool.configuration.south_east.to_a.reverse,
106
+ # LayersOfLondon::Booth::MapTool.configuration.south_west.to_a.reverse,
107
+ # LayersOfLondon::Booth::MapTool.configuration.north_west.to_a.reverse,
108
+ # ]
109
+ # ]
110
110
 
111
111
  ]
112
112
  },
@@ -18,7 +18,10 @@ module LayersOfLondon::Booth::MapTool
18
18
 
19
19
  class Scope < Scope
20
20
  def resolve
21
- scope.all
21
+ features = scope.limit(10).includes(:user, square: [:user]).all.collect do |poly|
22
+ # user_can_edit = LayersOfLondon::Booth::MapTool::PolygonPolicy.new(user, poly).update?
23
+ poly.to_json(user_can_edit: user.present?)
24
+ end
22
25
  end
23
26
  end
24
27
  end
@@ -1,7 +1,7 @@
1
1
  module LayersOfLondon
2
2
  module Booth
3
3
  module MapTool
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2.1'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: layers_of_london-booth-map_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Hendrick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-11 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails