diff --git a/lib/concentrate/encoder/trip_updates_enhanced.ex b/lib/concentrate/encoder/trip_updates_enhanced.ex index ad018590..3cfb7db7 100644 --- a/lib/concentrate/encoder/trip_updates_enhanced.ex +++ b/lib/concentrate/encoder/trip_updates_enhanced.ex @@ -8,8 +8,6 @@ defmodule Concentrate.Encoder.TripUpdatesEnhanced do @impl Concentrate.Encoder def encode_groups(groups, opts \\ []) when is_list(groups) do - groups = Enum.reject(groups, &non_revenue?/1) - message = %{ header: feed_header(opts), entity: trip_update_feed_entity(groups, &build_stop_time_update/1, &enhanced_data/1) diff --git a/lib/concentrate/encoder/vehicle_positions_enhanced.ex b/lib/concentrate/encoder/vehicle_positions_enhanced.ex index 02a43a41..b00173fe 100644 --- a/lib/concentrate/encoder/vehicle_positions_enhanced.ex +++ b/lib/concentrate/encoder/vehicle_positions_enhanced.ex @@ -10,8 +10,6 @@ defmodule Concentrate.Encoder.VehiclePositionsEnhanced do @impl Concentrate.Encoder def encode_groups(groups, opts \\ []) when is_list(groups) do - groups = Enum.reject(groups, &non_revenue?/1) - message = %{ "header" => feed_header(opts), "entity" => Enum.flat_map(groups, &build_entity/1) diff --git a/test/concentrate/encoder/trip_updates_enhanced_test.exs b/test/concentrate/encoder/trip_updates_enhanced_test.exs index 1a4afb16..80b9d2a9 100644 --- a/test/concentrate/encoder/trip_updates_enhanced_test.exs +++ b/test/concentrate/encoder/trip_updates_enhanced_test.exs @@ -127,7 +127,7 @@ defmodule Concentrate.Encoder.TripUpdatesEnhancedTest do } = encoded end - test "Non-revenue trips are dropped" do + test "Non-revenue trips are included" do parsed = [ TripDescriptor.new( trip_id: "NONREV-trip", @@ -145,7 +145,19 @@ defmodule Concentrate.Encoder.TripUpdatesEnhancedTest do encoded = Jason.decode!(encode_groups(group(parsed))) assert %{ - "entity" => [] + "entity" => [ + %{ + "id" => "NONREV-trip", + "trip_update" => %{ + "trip" => %{ + "direction_id" => 0, + "revenue" => false, + "route_id" => "route", + "trip_id" => "NONREV-trip" + } + } + } + ] } = encoded end end diff --git a/test/concentrate/encoder/vehicle_positions_enhanced_test.exs b/test/concentrate/encoder/vehicle_positions_enhanced_test.exs index b5d84c99..02f5c826 100644 --- a/test/concentrate/encoder/vehicle_positions_enhanced_test.exs +++ b/test/concentrate/encoder/vehicle_positions_enhanced_test.exs @@ -66,7 +66,7 @@ defmodule Concentrate.Encoder.VehiclePositionsEnhancedTest do assert [] == FeedUpdate.updates(round_trip(data)) end - test "filters non-revenue trips" do + test "includes non-revenue trips" do data = [ TripDescriptor.new(trip_id: "one", vehicle_id: "y1", revenue: false), VehiclePosition.new( @@ -78,7 +78,21 @@ defmodule Concentrate.Encoder.VehiclePositionsEnhancedTest do ) ] - assert [] == FeedUpdate.updates(round_trip(data)) + assert [ + %Concentrate.TripDescriptor{ + trip_id: "one", + vehicle_id: "y1", + revenue: false, + schedule_relationship: :SCHEDULED + }, + %Concentrate.VehiclePosition{ + id: "y1", + trip_id: "one", + latitude: 1, + longitude: 1, + status: :IN_TRANSIT_TO + } + ] == FeedUpdate.updates(round_trip(data)) end end