2019-10-31 20:08:56 +01:00
|
|
|
const formatStationBoardReq = (ctx, station, type) => {
|
2024-02-06 22:58:49 +01:00
|
|
|
const {profile, opt} = ctx;
|
2019-10-31 20:08:56 +01:00
|
|
|
|
2020-03-09 21:59:17 +01:00
|
|
|
const jnyFltrL = [
|
2024-02-06 22:58:49 +01:00
|
|
|
profile.formatProductsFilter(ctx, opt.products || {}),
|
|
|
|
];
|
2020-03-09 21:59:17 +01:00
|
|
|
if (opt.line !== null) {
|
2024-02-06 22:58:49 +01:00
|
|
|
jnyFltrL.push({type: 'LINEID', mode: 'INC', value: opt.line});
|
2020-03-09 21:59:17 +01:00
|
|
|
}
|
|
|
|
|
2019-10-31 20:08:56 +01:00
|
|
|
const req = {
|
|
|
|
type,
|
|
|
|
date: profile.formatDate(profile, opt.when),
|
|
|
|
time: profile.formatTime(profile, opt.when),
|
|
|
|
stbLoc: station,
|
2024-02-06 22:58:49 +01:00
|
|
|
dirLoc: opt.direction
|
|
|
|
? profile.formatStation(opt.direction)
|
|
|
|
: undefined,
|
2020-03-09 21:59:17 +01:00
|
|
|
jnyFltrL,
|
2024-02-06 22:58:49 +01:00
|
|
|
dur: opt.duration,
|
|
|
|
};
|
2020-03-20 20:02:42 +01:00
|
|
|
if (opt.results !== null) {
|
2024-02-06 22:58:49 +01:00
|
|
|
req.maxJny = opt.results === Infinity
|
|
|
|
? 10000
|
|
|
|
: opt.results;
|
|
|
|
}
|
|
|
|
if (profile.departuresGetPasslist) {
|
|
|
|
req.getPasslist = Boolean(opt.stopovers);
|
|
|
|
}
|
|
|
|
if (profile.departuresStbFltrEquiv) {
|
|
|
|
req.stbFltrEquiv = !opt.includeRelatedStations;
|
2020-03-20 20:02:42 +01:00
|
|
|
}
|
2019-10-31 20:08:56 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
meth: 'StationBoard',
|
2024-02-06 22:58:49 +01:00
|
|
|
req,
|
|
|
|
};
|
|
|
|
};
|
2019-10-31 20:08:56 +01:00
|
|
|
|
2022-05-07 16:17:37 +02:00
|
|
|
export {
|
|
|
|
formatStationBoardReq,
|
2024-02-06 22:58:49 +01:00
|
|
|
};
|