Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
s3cur3 authored Aug 30, 2024
1 parent f3d6378 commit 1bd2bff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
21 changes: 9 additions & 12 deletions lib/geo/json/decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,15 @@ defmodule Geo.JSON.Decoder do
defp do_decode("Feature", nil, _properties, _id), do: nil

defp do_decode("Feature", geometry, properties, _id) do
cond do

Map.get(geometry, "type") == "GeometryCollection" ->
geometry_collection = decode!(geometry)

%GeometryCollection{
geometries: geometry_collection.geometries,
properties: properties
}

true ->
do_decode(Map.get(geometry, "type"), Map.get(geometry, "coordinates"), properties, nil)
if geometry["type"] == "GeometryCollection" do
geometry_collection = decode!(geometry)

%GeometryCollection{
geometries: geometry_collection.geometries,
properties: properties
}
else
do_decode(Map.get(geometry, "type"), Map.get(geometry, "coordinates"), properties, nil)
end
end

Expand Down
5 changes: 3 additions & 2 deletions test/geo/json_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,9 @@ defmodule Geo.JSON.Test do

geom = Jason.decode!(json) |> Geo.JSON.decode!()

assert(Enum.count(geom.geometries) == 2)
assert(Enum.each(geom.geometries, fn (%Geo.MultiPolygon{} = g) -> true end))
assert %GeometryCollection{} = geom

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.14.4, 23.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.13.4, 25.3.2)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.12.3, 22.3)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.13.4, 23.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.14.4, 24.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.11.4, 23.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.12.3, 24.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.12.3, 23.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.13.4, 24.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.14.4, 26.0.2)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.11.4, 24.3.4)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.14.4, 25.3.2)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.13.4, 22.3)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code

Check failure on line 525 in test/geo/json_test.exs

View workflow job for this annotation

GitHub Actions / Elixir Unit Tests (1.11.4, 22.3)

** (CompileError) test/geo/json_test.exs:525: GeometryCollection.__struct__/0 is undefined, cannot expand struct GeometryCollection. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code
assert length(geom.geometries) == 2
assert Enum.all?(geom.geometries, &match?(%Geo.MultiPolygon{}, &1))
assert geom.properties["id"] == "FLC017"
end
end

0 comments on commit 1bd2bff

Please sign in to comment.