Skip to content

Commit bd9ede7

Browse files
authored
Disable keep Promise function (#244)
* wip * wip * wip
1 parent b074792 commit bd9ede7

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

src/lib/server/booking/bookRide.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ export async function bookRide(
7878
userChosen,
7979
[{ ...busStop, times: [busTime] }],
8080
required,
81-
startFixed,
82-
{
83-
pickup: c.startTime,
84-
dropoff: c.targetTime
85-
}
81+
startFixed
82+
//{
83+
// pickup: c.startTime,
84+
// dropoff: c.targetTime
85+
//}
8686
)
8787
)[0][0];
8888
if (best == undefined) {

src/lib/server/booking/evaluateRequest.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { BusStop } from './BusStop';
55
import type { Capacities } from './Capacities';
66
import { getPossibleInsertions } from './getPossibleInsertions';
77
import type { Company } from './getBookingAvailability';
8-
import type { PromisedTimes } from './PromisedTimes';
8+
//import type { PromisedTimes } from './PromisedTimes';
99
import type { Range } from './getPossibleInsertions';
1010
import { gatherRoutingCoordinates, routing } from './routing';
1111
import {
@@ -26,8 +26,8 @@ export async function evaluateRequest(
2626
userChosen: Coordinates,
2727
busStops: BusStop[],
2828
required: Capacities,
29-
startFixed: boolean,
30-
promisedTimes?: PromisedTimes
29+
startFixed: boolean
30+
//promisedTimes?: PromisedTimes
3131
) {
3232
if (companies.length == 0) {
3333
return busStops.map((bs) => bs.times.map((_) => undefined));
@@ -97,8 +97,8 @@ export async function evaluateRequest(
9797
busStopTimes,
9898
routingResults,
9999
directDurations,
100-
allowedTimes,
101-
promisedTimes
100+
allowedTimes
101+
//promisedTimes
102102
);
103103
return newTourEvaluations;
104104
}

src/lib/server/booking/insertion.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
getNextLegDuration,
2222
returnsToCompany
2323
} from './durations';
24-
import type { PromisedTimes } from './PromisedTimes';
24+
//import type { PromisedTimes } from './PromisedTimes';
2525
import type { Interval } from '$lib/server/util/interval';
2626
import type { RoutingResults } from './routing';
2727
import type { Company, Event } from './getBookingAvailability';
@@ -139,8 +139,8 @@ export function evaluateBothInsertion(
139139
busStopIdx: number | undefined,
140140
prev: Event | undefined,
141141
next: Event | undefined,
142-
allowedTimes: Interval[],
143-
promisedTimes?: PromisedTimes
142+
allowedTimes: Interval[]
143+
//promisedTimes?: PromisedTimes
144144
): InsertionEvaluation | undefined {
145145
console.assert(
146146
insertionCase.what == InsertWhat.BOTH,
@@ -177,12 +177,14 @@ export function evaluateBothInsertion(
177177
if (arrivalWindow == undefined) {
178178
return undefined;
179179
}
180+
/*
180181
if (
181182
promisedTimes != undefined &&
182183
!keepsPromises(insertionCase, arrivalWindow, passengerDuration, promisedTimes)
183184
) {
184185
return undefined;
185186
}
187+
*/
186188
const taxiDuration =
187189
prevLegDuration +
188190
nextLegDuration +
@@ -233,8 +235,8 @@ export function evaluateNewTours(
233235
busStopTimes: Interval[][],
234236
routingResults: RoutingResults,
235237
travelDurations: (number | undefined)[],
236-
allowedTimes: Interval[],
237-
promisedTimes?: PromisedTimes
238+
allowedTimes: Interval[]
239+
//promisedTimes?: PromisedTimes
238240
): (Insertion | undefined)[][] {
239241
const bestEvaluations = new Array<(Insertion | undefined)[]>(busStopTimes.length);
240242
for (let i = 0; i != busStopTimes.length; ++i) {
@@ -280,8 +282,8 @@ export function evaluateNewTours(
280282
busStopIdx,
281283
undefined,
282284
undefined,
283-
allowedTimes,
284-
promisedTimes
285+
allowedTimes
286+
//promisedTimes
285287
);
286288
if (
287289
resultNewTour != undefined &&
@@ -357,7 +359,7 @@ const getOldDrivingTime = (
357359
}
358360
return prev.nextLegDuration;
359361
};
360-
362+
/*
361363
const keepsPromises = (
362364
insertionCase: InsertionType,
363365
arrivalWindow: Interval,
@@ -414,3 +416,4 @@ const keepsPromises = (
414416
}
415417
return true;
416418
};
419+
*/

0 commit comments

Comments
 (0)