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", "name": "@mobicoop/matcher",
"version": "1.3.0", "version": "1.3.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@mobicoop/matcher", "name": "@mobicoop/matcher",
"version": "1.3.0", "version": "1.3.1",
"license": "AGPL", "license": "AGPL",
"dependencies": { "dependencies": {
"@grpc/grpc-js": "^1.9.9", "@grpc/grpc-js": "^1.9.9",

View File

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

View File

@ -38,24 +38,22 @@ export class Journey extends ValueObject<JourneyProps> {
actorTime.target == Target.START, actorTime.target == Target.START,
) as ActorTime, ) as ActorTime,
) as JourneyItem; ) as JourneyItem;
const passengerDepartureActorTime = const passengerDepartureActorTime: ActorTime =
passengerDepartureJourneyItem.actorTimes.find( passengerDepartureJourneyItem.actorTimes.find(
(actorTime: ActorTime) => (actorTime: ActorTime) =>
actorTime.role == Role.PASSENGER && actorTime.target == Target.START, actorTime.role == Role.PASSENGER && actorTime.target == Target.START,
) as ActorTime; ) as ActorTime;
const driverNeutralActorTime = const driverActorTime = passengerDepartureJourneyItem.actorTimes.find(
passengerDepartureJourneyItem.actorTimes.find( (actorTime: ActorTime) => actorTime.role == Role.DRIVER,
(actorTime: ActorTime) => ) as ActorTime;
actorTime.role == Role.DRIVER && actorTime.target == Target.NEUTRAL,
) as ActorTime;
return ( return (
(passengerDepartureActorTime.firstMinDatetime <= (passengerDepartureActorTime.firstMinDatetime <=
driverNeutralActorTime.firstMaxDatetime && driverActorTime.firstMaxDatetime &&
driverNeutralActorTime.firstMaxDatetime <= driverActorTime.firstMaxDatetime <=
passengerDepartureActorTime.firstMaxDatetime) || passengerDepartureActorTime.firstMaxDatetime) ||
(passengerDepartureActorTime.firstMinDatetime <= (passengerDepartureActorTime.firstMinDatetime <=
driverNeutralActorTime.firstMinDatetime && driverActorTime.firstMinDatetime &&
driverNeutralActorTime.firstMinDatetime <= driverActorTime.firstMinDatetime <=
passengerDepartureActorTime.firstMaxDatetime) passengerDepartureActorTime.firstMaxDatetime)
); );
}; };