diff --git a/src/modules/ad/core/domain/value-objects/journey.value-object.ts b/src/modules/ad/core/domain/value-objects/journey.value-object.ts index d36bc9e..836aed9 100644 --- a/src/modules/ad/core/domain/value-objects/journey.value-object.ts +++ b/src/modules/ad/core/domain/value-objects/journey.value-object.ts @@ -38,24 +38,22 @@ export class Journey extends ValueObject { actorTime.target == Target.START, ) as ActorTime, ) as JourneyItem; - const passengerDepartureActorTime = + const passengerDepartureActorTime: ActorTime = passengerDepartureJourneyItem.actorTimes.find( (actorTime: ActorTime) => actorTime.role == Role.PASSENGER && actorTime.target == Target.START, ) as ActorTime; - const driverNeutralActorTime = - passengerDepartureJourneyItem.actorTimes.find( - (actorTime: ActorTime) => - actorTime.role == Role.DRIVER && actorTime.target == Target.NEUTRAL, - ) as ActorTime; + const driverActorTime = passengerDepartureJourneyItem.actorTimes.find( + (actorTime: ActorTime) => actorTime.role == Role.DRIVER, + ) as ActorTime; return ( (passengerDepartureActorTime.firstMinDatetime <= - driverNeutralActorTime.firstMaxDatetime && - driverNeutralActorTime.firstMaxDatetime <= + driverActorTime.firstMaxDatetime && + driverActorTime.firstMaxDatetime <= passengerDepartureActorTime.firstMaxDatetime) || (passengerDepartureActorTime.firstMinDatetime <= - driverNeutralActorTime.firstMinDatetime && - driverNeutralActorTime.firstMinDatetime <= + driverActorTime.firstMinDatetime && + driverActorTime.firstMinDatetime <= passengerDepartureActorTime.firstMaxDatetime) ); };