mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-22 22:59:35 +02:00
31 lines
710 B
JavaScript
31 lines
710 B
JavaScript
// https://www.bahn.de/p/view/service/buchung/auslastungsinformation.shtml
|
|
const loadFactors = [];
|
|
loadFactors[1] = 'low-to-medium';
|
|
loadFactors[2] = 'high';
|
|
loadFactors[3] = 'very-high';
|
|
loadFactors[4] = 'exceptionally-high';
|
|
|
|
const parseLoadFactor = (opt, auslastung) => {
|
|
if (!auslastung) {
|
|
return null;
|
|
}
|
|
const cls = opt.firstClass
|
|
? 'KLASSE_1'
|
|
: 'KLASSE_2';
|
|
const load = auslastung.find(a => a.klasse === cls)?.stufe;
|
|
return load && loadFactors[load] || null;
|
|
};
|
|
|
|
const parseArrOrDepWithLoadFactor = (ctx, d) => {
|
|
|
|
/* const load = parseLoadFactor(opt, d);
|
|
if (load) {
|
|
parsed.loadFactor = load;
|
|
}*/ // TODO
|
|
return undefined;
|
|
};
|
|
|
|
export {
|
|
parseArrOrDepWithLoadFactor,
|
|
parseLoadFactor,
|
|
};
|