Merge branch 'fixJourneyVO' into 'main'

Fix journey vo

See merge request v3/service/matcher!15
This commit is contained in:
Sylvain Briat 2023-11-02 16:19:14 +00:00
commit c5e58db5a6
3 changed files with 11 additions and 13 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@mobicoop/matcher",
"version": "1.3.0",
"version": "1.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mobicoop/matcher",
"version": "1.3.0",
"version": "1.3.1",
"license": "AGPL",
"dependencies": {
"@grpc/grpc-js": "^1.9.9",

View File

@ -1,6 +1,6 @@
{
"name": "@mobicoop/matcher",
"version": "1.3.0",
"version": "1.3.1",
"description": "Mobicoop V3 Matcher",
"author": "sbriat",
"private": true,

View File

@ -38,24 +38,22 @@ export class Journey extends ValueObject<JourneyProps> {
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)
);
};