Merge branch 'fixEmptyJourneys' into 'main'
Fix empty journeys See merge request v3/service/matcher!21
This commit is contained in:
commit
59596fadee
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@mobicoop/matcher",
|
||||
"version": "1.4.2",
|
||||
"version": "1.4.3",
|
||||
"description": "Mobicoop V3 Matcher",
|
||||
"author": "sbriat",
|
||||
"private": true,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -53,6 +53,7 @@ export class CandidateEntity extends AggregateRoot<CandidateProps> {
|
|||
* This is a tedious process : additional information can be found in deeper methods !
|
||||
*/
|
||||
createJourneys = (): CandidateEntity => {
|
||||
try {
|
||||
this.props.journeys = this.props.driverSchedule
|
||||
// first we create the journeys
|
||||
.map((driverScheduleItem: ScheduleItem) =>
|
||||
|
@ -60,6 +61,10 @@ export class CandidateEntity extends AggregateRoot<CandidateProps> {
|
|||
)
|
||||
// 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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue