From 712faac34597f4c521be73c6015c92eb8bcffb8f Mon Sep 17 00:00:00 2001 From: nils Date: Thu, 19 Sep 2024 14:22:15 +0200 Subject: [PATCH] Format --- src/routes/api/blacklisting/viableBusStops.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/routes/api/blacklisting/viableBusStops.ts b/src/routes/api/blacklisting/viableBusStops.ts index c33a87ce..6803b0a0 100644 --- a/src/routes/api/blacklisting/viableBusStops.ts +++ b/src/routes/api/blacklisting/viableBusStops.ts @@ -41,13 +41,15 @@ const withBusStops = (busStops: BusStop[], startFixed: boolean) => { let cteValues: RawBuilder[] = []; for (let i = 0; i != busStops.length; ++i) { cteValues = cteValues.concat( - busStops[i].times.map( - (t, j) =>{ - const startTime = startFixed ? t : new Date(t.getTime() - MAX_PASSENGER_WAITING_TIME_DROPOFF); - const endTime = startFixed ? new Date(t.getTime() + MAX_PASSENGER_WAITING_TIME_PICKUP) : t; - return sql`SELECT cast(${i} as integer) AS busstopindex, cast(${j} as integer) AS index, ${startTime} AS starttime, ${endTime} AS endtime` - } - ) + busStops[i].times.map((t, j) => { + const startTime = startFixed + ? t + : new Date(t.getTime() - MAX_PASSENGER_WAITING_TIME_DROPOFF); + const endTime = startFixed + ? new Date(t.getTime() + MAX_PASSENGER_WAITING_TIME_PICKUP) + : t; + return sql`SELECT cast(${i} as integer) AS busstopindex, cast(${j} as integer) AS index, ${startTime} AS starttime, ${endTime} AS endtime`; + }) ); } return db