diff --git a/apps/transport/lib/irve/extractor.ex b/apps/transport/lib/irve/extractor.ex index 169b128dae..f0625e33b2 100644 --- a/apps/transport/lib/irve/extractor.ex +++ b/apps/transport/lib/irve/extractor.ex @@ -111,6 +111,7 @@ defmodule Transport.IRVE.Extractor do |> Enum.map(fn x -> Map.take(x, [ :dataset_id, + :http_status, :dataset_title, :dataset_organisation_name, :dataset_organisation_url, @@ -133,7 +134,7 @@ defmodule Transport.IRVE.Extractor do Transport.IRVE.Fetcher.get!(row[:url], compressed: false, decode_body: false) row - |> Map.put(:status, status) + |> Map.put(:http_status, status) |> Map.put(:index, index) |> then(fn x -> process_resource_body(x, body) end) end @@ -142,7 +143,7 @@ defmodule Transport.IRVE.Extractor do For a given resource and corresponding body, enrich data with extra stuff like estimated number of charge points. """ - def process_resource_body(%{status: 200} = row, body) do + def process_resource_body(%{http_status: 200} = row, body) do body = body |> String.split("\n") first_line = body |> hd() line_count = (body |> length) - 1 diff --git a/apps/transport/test/transport/irve/irve_extractor_test.exs b/apps/transport/test/transport/irve/irve_extractor_test.exs index f8d7590a52..56aeb36c83 100644 --- a/apps/transport/test/transport/irve/irve_extractor_test.exs +++ b/apps/transport/test/transport/irve/irve_extractor_test.exs @@ -117,6 +117,7 @@ defmodule Transport.IRVE.ExtractorTest do orig_resource |> Map.put(:index, 0) |> Map.put(:line_count, 3) + |> Map.put(:http_status, 200) |> Map.delete(:url) ] end @@ -147,6 +148,7 @@ defmodule Transport.IRVE.ExtractorTest do assert Transport.IRVE.Extractor.download_and_parse_all(resources) == [ orig_resource |> Map.put(:index, 0) + |> Map.put(:http_status, 404) |> Map.delete(:url) ] end