@@ -7,6 +7,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
77
88 @ trip_id "trip"
99 @ route_id "route"
10+ @ direction_id 0
1011 @ valid_date { 1970 , 1 , 1 }
1112 @ valid_date_time 8
1213
@@ -28,6 +29,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
2829 TripDescriptor . new (
2930 trip_id: @ trip_id ,
3031 route_id: @ route_id ,
32+ direction_id: @ direction_id ,
3133 start_date: @ valid_date
3234 )
3335
@@ -59,6 +61,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
5961 TripDescriptor . new (
6062 trip_id: @ trip_id ,
6163 route_id: @ route_id ,
64+ direction_id: @ direction_id ,
6265 start_date: { 1970 , 1 , 1 }
6366 ) ,
6467 stus: [
@@ -112,6 +115,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
112115 TripDescriptor . new (
113116 trip_id: @ trip_id ,
114117 route_id: @ route_id ,
118+ direction_id: @ direction_id ,
115119 start_date: { 1970 , 1 , 1 }
116120 ) ,
117121 stus: [
@@ -149,6 +153,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
149153 TripDescriptor . new (
150154 trip_id: @ trip_id ,
151155 route_id: @ route_id ,
156+ direction_id: @ direction_id ,
152157 start_date: { 1970 , 1 , 1 }
153158 ) ,
154159 stus: [
@@ -187,6 +192,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
187192 TripDescriptor . new (
188193 trip_id: @ trip_id ,
189194 route_id: @ route_id ,
195+ direction_id: @ direction_id ,
190196 start_date: { 1970 , 1 , 1 }
191197 ) ,
192198 stus: [
@@ -210,6 +216,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
210216 TripDescriptor . new (
211217 trip_id: @ trip_id ,
212218 route_id: @ route_id ,
219+ direction_id: @ direction_id ,
213220 start_date: { 1970 , 1 , 1 }
214221 ) ,
215222 stus: [
@@ -230,7 +237,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
230237 TripDescriptor . new (
231238 trip_id: @ trip_id ,
232239 route_id: "single_direction" ,
233- direction_id: 0 ,
240+ direction_id: @ direction_id ,
234241 start_date: { 1970 , 1 , 1 }
235242 ) ,
236243 stus: [
@@ -274,7 +281,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
274281 TripDescriptor . new (
275282 trip_id: "other_trip" ,
276283 route_id: @ route_id ,
277- direction_id: 0 ,
284+ direction_id: @ direction_id ,
278285 start_date: { 1970 , 1 , 1 }
279286 ) ,
280287 stus: [
@@ -296,6 +303,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
296303 TripDescriptor . new (
297304 trip_id: @ trip_id ,
298305 route_id: @ route_id ,
306+ direction_id: @ direction_id ,
299307 start_date: { 1970 , 1 , 1 }
300308 ) ,
301309 stus: [
@@ -349,6 +357,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
349357 TripDescriptor . new (
350358 trip_id: @ trip_id ,
351359 route_id: @ route_id ,
360+ direction_id: @ direction_id ,
352361 start_date: { 1970 , 1 , 1 }
353362 ) ,
354363 stus: [
@@ -389,6 +398,7 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
389398 TripDescriptor . new (
390399 trip_id: @ trip_id ,
391400 route_id: @ route_id ,
401+ direction_id: @ direction_id ,
392402 start_date: { 1970 , 1 , 1 }
393403 ) ,
394404 stus: [
@@ -414,10 +424,57 @@ defmodule Concentrate.GroupFilter.ShuttleTest do
414424 assert StopTimeUpdate . departure_time ( stop )
415425 end
416426
427+ test "start of a shuttle in one direction doesn't affect STUs in the opposite direction" do
428+ group =
429+ % TripGroup {
430+ td:
431+ TripDescriptor . new (
432+ trip_id: @ trip_id ,
433+ route_id: @ route_id ,
434+ direction_id: @ direction_id ,
435+ start_date: { 1970 , 1 , 1 }
436+ ) ,
437+ stus: [
438+ StopTimeUpdate . new (
439+ trip_id: @ trip_id ,
440+ stop_id: "shuttle_start_unidirectional" ,
441+ departure_time: @ valid_date_time
442+ ) ,
443+ StopTimeUpdate . new (
444+ trip_id: @ trip_id ,
445+ stop_id: "after_shuttle" ,
446+ arrival_time: @ valid_date_time ,
447+ departure_time: @ valid_date_time
448+ ) ,
449+ StopTimeUpdate . new (
450+ trip_id: @ trip_id ,
451+ stop_id: "after_shuttle_2" ,
452+ arrival_time: @ valid_date_time
453+ )
454+ ]
455+ }
456+
457+ % TripGroup { stus: reduced } = filter ( group , @ module )
458+
459+ assert [ start_unidirectional , after_shuttle , after_shuttle_2 ] = reduced
460+ assert StopTimeUpdate . schedule_relationship ( start_unidirectional ) == :SCHEDULED
461+ assert StopTimeUpdate . departure_time ( start_unidirectional )
462+ assert StopTimeUpdate . schedule_relationship ( after_shuttle ) == :SCHEDULED
463+ assert StopTimeUpdate . arrival_time ( after_shuttle )
464+ assert StopTimeUpdate . departure_time ( after_shuttle )
465+ assert StopTimeUpdate . schedule_relationship ( after_shuttle_2 ) == :SCHEDULED
466+ assert StopTimeUpdate . arrival_time ( after_shuttle_2 )
467+ end
468+
417469 test "updates on non-shuttle trips are not modified" do
418470 group =
419471 % TripGroup {
420- td: TripDescriptor . new ( trip_id: "other_trip" , start_date: @ valid_date ) ,
472+ td:
473+ TripDescriptor . new (
474+ trip_id: "other_trip" ,
475+ direction_id: @ direction_id ,
476+ start_date: @ valid_date
477+ ) ,
421478 stus: [
422479 StopTimeUpdate . new (
423480 trip_id: "other_trip" ,
0 commit comments