handle excluded ad in query and selector

This commit is contained in:
Sylvain Briat 2024-04-03 13:02:31 +02:00
parent 0c29e522ed
commit 16ebe8d543
3 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@ export class MatchQuery extends QueryBase {
seatsRequested?: number;
strict?: boolean;
readonly waypoints: Waypoint[];
excludedAdId?: string;
algorithmType?: AlgorithmType;
remoteness?: number;
useProportion?: boolean;
@ -56,6 +57,7 @@ export class MatchQuery extends QueryBase {
this.seatsRequested = props.seatsRequested;
this.strict = props.strict;
this.waypoints = props.waypoints;
this.excludedAdId = props.excludedAdId;
this.algorithmType = props.algorithmType;
this.remoteness = props.remoteness;
this.useProportion = props.useProportion;

View File

@ -136,6 +136,7 @@ export class PassengerOrientedSelector extends Selector {
this._whereStrict(),
this._whereDate(),
this._whereSchedule(role),
this._whereExcludedAd(),
this._whereAzimuth(),
this._whereProportion(role),
this._whereRemoteness(role),
@ -206,6 +207,9 @@ export class PassengerOrientedSelector extends Selector {
return '';
};
private _whereExcludedAd = (): string =>
this.query.excludedAdId ? `ad.uuid <> '${this.query.excludedAdId}'` : '';
private _wherePassengerSchedule = (
date: Date,
scheduleItem: ScheduleItem,

View File

@ -47,6 +47,7 @@ const matchQuery = new MatchQuery(
],
strict: false,
waypoints: [originWaypoint, destinationWaypoint],
excludedAdId: '758618c6-dd82-4199-a548-0205161b04d7',
},
bareMockGeorouter,
);