fix journey leg alternatives 🐛

- use realtime data if available
- don't filter by departure station (HAFAS IDs are complicated)
This commit is contained in:
Jannis R 2018-04-29 13:41:21 +02:00
parent c030724663
commit d676b8430d
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -58,15 +58,15 @@ const createParseJourneyLeg = (profile, stations, lines, remarks) => {
if (pt.jny.freq && pt.jny.freq.jnyL) { if (pt.jny.freq && pt.jny.freq.jnyL) {
const parseAlternative = (a) => { const parseAlternative = (a) => {
const t = a.stopL[0].dTimeS || a.stopL[0].dTimeR const t = a.stopL[0].dTimeR || a.stopL[0].dTimeS
const when = profile.parseDateTime(profile, j.date, t) const when = profile.parseDateTime(profile, j.date, t)
// todo: expose a.stopL[0]
return { return {
line: lines[parseInt(a.prodX)] || null, line: lines[parseInt(a.prodX)] || null,
when: when.toISO() when: when.toISO()
} }
} }
res.alternatives = pt.jny.freq.jnyL res.alternatives = pt.jny.freq.jnyL
.filter(a => a.stopL[0].locX === pt.dep.locX)
.map(parseAlternative) .map(parseAlternative)
} }
} }