Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
nilspenzel committed Sep 19, 2024
1 parent 1191386 commit 712faac
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/routes/api/blacklisting/viableBusStops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ const withBusStops = (busStops: BusStop[], startFixed: boolean) => {
let cteValues: RawBuilder<string>[] = [];
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<string>`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<string>`SELECT cast(${i} as integer) AS busstopindex, cast(${j} as integer) AS index, ${startTime} AS starttime, ${endTime} AS endtime`;
})
);
}
return db
Expand Down

0 comments on commit 712faac

Please sign in to comment.