Enable usage of 1st class BahnCards and fix typo

This commit is contained in:
Tobias Roehr 2021-03-25 12:39:00 +01:00 committed by Jannis R
parent 9bfd4566ae
commit 6f56f15284

View file

@ -2,7 +2,7 @@
// todo: generate from https://reiseauskunft.bahn.de/addons/fachkonfig-utf8.cfg ? // todo: generate from https://reiseauskunft.bahn.de/addons/fachkonfig-utf8.cfg ?
const c = { const c = {
NONE: Symbol('no loyaly card'), NONE: Symbol('no loyalty card'),
BAHNCARD: Symbol('Bahncard'), BAHNCARD: Symbol('Bahncard'),
VORTEILSCARD: Symbol('VorteilsCard'), VORTEILSCARD: Symbol('VorteilsCard'),
HALBTAXABO: Symbol('HalbtaxAbo'), HALBTAXABO: Symbol('HalbtaxAbo'),
@ -14,8 +14,8 @@ const c = {
// see https://gist.github.com/juliuste/202bb04f450a79f8fa12a2ec3abcd72d // see https://gist.github.com/juliuste/202bb04f450a79f8fa12a2ec3abcd72d
const formatLoyaltyCard = (data) => { const formatLoyaltyCard = (data) => {
if (data.type === c.BAHNCARD) { if (data.type === c.BAHNCARD) {
if (data.discount === 25) return c.class === 1 ? 1 : 2 if (data.discount === 25) return data.class === 1 ? 1 : 2
if (data.discount === 50) return c.class === 1 ? 3 : 4 if (data.discount === 50) return data.class === 1 ? 3 : 4
} }
if (data.type === c.VORTEILSCARD) return 9 if (data.type === c.VORTEILSCARD) return 9
if (data.type === c.HALBTAXABO) return data.railplus ? 10 : 11 if (data.type === c.HALBTAXABO) return data.railplus ? 10 : 11