From 970260f0d2496f50d7c76b05d6ee363bef7885f5 Mon Sep 17 00:00:00 2001 From: Sylvain Briat Date: Tue, 21 Nov 2023 16:10:19 +0100 Subject: [PATCH 1/2] fix crash when no date is available in recurrent for a journey --- .../application/queries/match/match.query.ts | 1 + .../ad/core/domain/candidate.entity.ts | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/modules/ad/core/application/queries/match/match.query.ts b/src/modules/ad/core/application/queries/match/match.query.ts index 937ed4c..e9d1b6e 100644 --- a/src/modules/ad/core/application/queries/match/match.query.ts +++ b/src/modules/ad/core/application/queries/match/match.query.ts @@ -42,6 +42,7 @@ export class MatchQuery extends QueryBase { private readonly originWaypoint: Waypoint; routeProvider: RouteProviderPort; + // TODO: remove MatchRequestDto depency (here core domain depends on interface /!\) constructor(props: MatchRequestDto, routeProvider: RouteProviderPort) { super(); this.id = props.id; diff --git a/src/modules/ad/core/domain/candidate.entity.ts b/src/modules/ad/core/domain/candidate.entity.ts index ec3a7c9..434fe05 100644 --- a/src/modules/ad/core/domain/candidate.entity.ts +++ b/src/modules/ad/core/domain/candidate.entity.ts @@ -53,13 +53,18 @@ export class CandidateEntity extends AggregateRoot { * This is a tedious process : additional information can be found in deeper methods ! */ createJourneys = (): CandidateEntity => { - this.props.journeys = this.props.driverSchedule - // first we create the journeys - .map((driverScheduleItem: ScheduleItem) => - this._createJourney(driverScheduleItem), - ) - // then we filter the ones with invalid pickups - .filter((journey: Journey) => journey.hasValidPickUp()); + try { + this.props.journeys = this.props.driverSchedule + // first we create the journeys + .map((driverScheduleItem: ScheduleItem) => + this._createJourney(driverScheduleItem), + ) + // then we filter the ones with invalid pickups + .filter((journey: Journey) => journey.hasValidPickUp()); + } catch (e) { + // irrelevant journeys fall here + // eg. no available day for the given date range + } return this; }; From eee0fd070a4fa134b44d603579a37ead7a0b792c Mon Sep 17 00:00:00 2001 From: Sylvain Briat Date: Tue, 21 Nov 2023 16:10:25 +0100 Subject: [PATCH 2/2] 1.4.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3addb7f..6c3068e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mobicoop/matcher", - "version": "1.4.2", + "version": "1.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mobicoop/matcher", - "version": "1.4.2", + "version": "1.4.3", "license": "AGPL", "dependencies": { "@grpc/grpc-js": "^1.9.9", diff --git a/package.json b/package.json index 49ca18b..ca73892 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mobicoop/matcher", - "version": "1.4.2", + "version": "1.4.3", "description": "Mobicoop V3 Matcher", "author": "sbriat", "private": true,