2025-01-10 18:55:14 +00:00
|
|
|
const parseTrip = (ctx, t, id) => { // t = raw trip
|
2024-12-08 21:42:57 +00:00
|
|
|
const {profile} = ctx;
|
2020-06-11 15:33:45 +02:00
|
|
|
|
|
|
|
// pretend the trip is a leg in a journey
|
2024-12-18 01:16:57 +00:00
|
|
|
const trip = profile.parseJourneyLeg(ctx, t);
|
2025-01-14 19:48:14 +00:00
|
|
|
trip.id = trip.tripId || id;
|
2024-02-06 22:58:49 +01:00
|
|
|
delete trip.tripId;
|
|
|
|
delete trip.reachable;
|
2025-01-14 19:48:14 +00:00
|
|
|
trip.cancelled = Boolean(profile.parseCancelled(t));
|
2020-06-11 15:33:45 +02:00
|
|
|
|
2024-12-07 16:16:31 +00:00
|
|
|
// TODO opt.scheduledDays
|
2024-02-06 22:58:49 +01:00
|
|
|
return trip;
|
|
|
|
};
|
2020-06-11 15:33:45 +02:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
export {
|
|
|
|
parseTrip,
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|