fix waystep completer

This commit is contained in:
sbriat 2023-09-13 15:57:22 +02:00
parent 74fb2c120e
commit c65a5b50c2
3 changed files with 7 additions and 12 deletions

View File

@ -11,7 +11,7 @@ import { WayStepsCreator } from '@modules/ad/core/domain/waysteps-creator.servic
/**
* Complete candidates by setting driver and crew waypoints
*/
export class PassengerOrientedWaypointsCompleter extends Completer {
export class PassengerOrientedWayStepsCompleter extends Completer {
complete = async (
candidates: CandidateEntity[],
): Promise<CandidateEntity[]> => {
@ -54,11 +54,6 @@ export class PassengerOrientedWaypointsCompleter extends Completer {
);
candidate.setWaySteps(carpoolPathCreator.getCrewCarpoolPath());
});
// console.log(
// candidates[0]
// .getProps()
// .waySteps?.map((waystep: WayStep) => waystep.actors),
// );
return candidates;
};
}

View File

@ -1,6 +1,6 @@
import { Algorithm } from './algorithm.abstract';
import { MatchQuery } from './match.query';
import { PassengerOrientedWaypointsCompleter } from './completer/passenger-oriented-waypoints.completer';
import { PassengerOrientedWayStepsCompleter } from './completer/passenger-oriented-waysteps.completer';
import { PassengerOrientedGeoFilter } from './filter/passenger-oriented-geo.filter';
import { AdRepositoryPort } from '../../ports/ad.repository.port';
import { PassengerOrientedSelector } from './selector/passenger-oriented.selector';
@ -13,7 +13,7 @@ export class PassengerOrientedAlgorithm extends Algorithm {
super(query, repository);
this.selector = new PassengerOrientedSelector(query, repository);
this.processors = [
new PassengerOrientedWaypointsCompleter(query),
new PassengerOrientedWayStepsCompleter(query),
new PassengerOrientedGeoFilter(query),
];
}

View File

@ -1,4 +1,4 @@
import { PassengerOrientedWaypointsCompleter } from '@modules/ad/core/application/queries/match/completer/passenger-oriented-waypoints.completer';
import { PassengerOrientedWayStepsCompleter } from '@modules/ad/core/application/queries/match/completer/passenger-oriented-waysteps.completer';
import { MatchQuery } from '@modules/ad/core/application/queries/match/match.query';
import { AlgorithmType } from '@modules/ad/core/application/types/algorithm.types';
import { Waypoint } from '@modules/ad/core/application/types/waypoint.type';
@ -75,10 +75,10 @@ const candidates: CandidateEntity[] = [
}),
];
describe('Passenger oriented waypoints completer', () => {
describe('Passenger oriented waysteps completer', () => {
it('should complete candidates', async () => {
const passengerOrientedWaypointsCompleter: PassengerOrientedWaypointsCompleter =
new PassengerOrientedWaypointsCompleter(matchQuery);
const passengerOrientedWaypointsCompleter: PassengerOrientedWayStepsCompleter =
new PassengerOrientedWayStepsCompleter(matchQuery);
const completedCandidates: CandidateEntity[] =
await passengerOrientedWaypointsCompleter.complete(candidates);
expect(completedCandidates.length).toBe(2);